Files
xMQL5/MQLTestWorkspace/BKPS/BKP/x121 old style indicators/Providers/x.saherelm.x121.provider.mq5
T

1591 lines
35 KiB
Plaintext

///////////////////////////////////////////////////////
//
// SaherElm IT Center MQL5 Expert Class Library
// ----------------------------------------------
// Name: XSCX121P
// Description: X121 Signal Provider ...
//
//
// Maintainer:
// ------------
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
//
//////////////////////////////////////////////////////
//
// Global Properties ...
#property library
#property copyright "Copyright 2023, SaherElm IT Center"
#property link "https://www.saherelm.ir"
#property version "1.00"
#property strict
//
// START Definitions ...
//
//
// END Definitions ...
//
//
// START Import and Inclused requirements ...
//
//
// Includes ...
#include "../Classes/x-saherelm.xprovider.class.mq5"
#include "../Helpers/x-saherelm.x121.xpv.helper.mq5"
#include "../Helpers/x-saherelm.x121.xhk.helper.mq5"
#include "../Helpers/x-saherelm.x121.xmc.helper.mq5"
#include "../Helpers/x-saherelm.x121.xich.helper.mq5"
#include "../Helpers/x-saherelm.x121.xmrb.helper.mq5"
#include "../Helpers/x-saherelm.x121.xppsr.helper.mq5"
#include "../Helpers/x-saherelm.x121.xsslc.helper.mq5"
#include "../Helpers/x-saherelm.x121.xtrnd.helper.mq5"
#include "../Helpers/x-saherelm.x121.xatrsl.helper.mq5"
//
// END Import and Inclused requirements ...
//
//
// START Overrides ...
//
//
// END Overrides ...
//
//
// a Base Class for All of our EA's ...
class XSCX121Provider : public XSCEABaseProvider
{
//
// Public ...
public:
//
// Props ...
//
// Define Helpers ...
//
// MC ...
XSCXMCHelper mMCHelper;
//
// PV ...
XSCXPVHelper mPVHelper;
//
// HKENASHI ...
XSCXHKHelper mHKHelper;
//
// MRB ...
XSCXMRBHelper mMRBHelper;
//
// ICHIMOKU ...
XSCXICHHelper mIchiHelper;
//
// SSLC ...
XSCXSSLCHelper mSSLCHelper;
//
// PPSR ...
XSCXPPSRHelper mPPSRHelper;
//
// TRND ...
XSCXTRNDHelper mTRNDHelper;
//
// ATRSL ...
XSCXATRSLHelper mATRSLHelper;
//
// Constructor ...
void XSCX121Provider() : XSCEABaseProvider(){};
void XSCX121Provider(
//
// Symbol ...
string symbol,
//
// Period ...
ENUM_TIMEFRAMES period
//
) : XSCEABaseProvider(symbol, period)
{
//
mTag = "X121_Provider_" + mSymbol + "_" + ToString(mPeriod);
//
mCTimerHandler = iCustom(
mSymbol,
mPeriod,
"x-saherelm.x121.xct",
//
// Inputs ...
clrYellow,
CORNER_RIGHT_LOWER
//
);
// //
// ArraySetAsSeries(mEMA200Buffer, true);
// mEMA200Handler = iMA(
// mSymbol,
// mPeriod,
// 200,
// 0,
// MODE_EMA,
// PRICE_CLOSE);
// //
// ArraySetAsSeries(mRSIBuffer, true);
// mRSIHandler = iRSI(
// mSymbol,
// mPeriod,
// 14,
// PRICE_CLOSE);
//
// CCI Initialization ...
ArraySetAsSeries(mCCIBuffer, true);
mCCIHandler = iCCI(
mSymbol,
mPeriod,
14,
PRICE_TYPICAL);
//
// Instance Helpers ...
//
// MC ...
mMCHelper = new XSCXMCHelper(
mSymbol,
mPeriod);
//
// PV ...
mPVHelper = new XSCXPVHelper(
mSymbol,
mPeriod);
//
// HIKENASHI ...
mHKHelper = new XSCXHKHelper(
mSymbol,
mPeriod);
//
// MRB ...
mMRBHelper = new XSCXMRBHelper(
mSymbol,
mPeriod);
//
// ICHIMOKU ...
mIchiHelper = new XSCXICHHelper(
mSymbol,
mPeriod);
//
// SSLC ...
mSSLCHelper = new XSCXSSLCHelper(
mSymbol,
mPeriod);
//
// PPSR ...
mPPSRHelper = new XSCXPPSRHelper(
mSymbol,
mPeriod);
//
// TRND ...
mTRNDHelper = new XSCXTRNDHelper(
mSymbol,
mPeriod);
//
// ATRSL ...
mATRSLHelper = new XSCXATRSLHelper(
mSymbol,
mPeriod);
}
//
// Deconstructor ...
void ~XSCX121Provider()
{
//
IndicatorRelease(mCCIHandler);
IndicatorRelease(mCTimerHandler);
// IndicatorRelease(mRSIHandler);
// IndicatorRelease(mIchimokuHandler);
// IndicatorRelease(mEMA200Handler);
//
// De construct Helpers ...
}
//
virtual void ProcessBuffers()
{
//
mMCHelper.ReadBuffers();
mPVHelper.ReadBuffers();
mHKHelper.ReadBuffers();
mMRBHelper.ReadBuffers();
mSSLCHelper.ReadBuffers();
mIchiHelper.ReadBuffers();
mPPSRHelper.ReadBuffers();
mTRNDHelper.ReadBuffers();
mATRSLHelper.ReadBuffers();
// //
// /// EMA 200 ...
// CopyBuffer(mEMA200Handler, 0, 0, 10, mEMA200Buffer);
// //
// /// RSI 14 ...
// CopyBuffer(mRSIHandler, 0, 0, 10, mRSIBuffer);
//
// CCI 14 ...
CopyBuffer(mCCIHandler, 0, 0, 10, mCCIBuffer);
}
//
virtual void ProcessTick()
{
ProcessSignals();
}
//
// Protected ...
protected:
//
// Private ...
private:
//
// CCandle Timer ...
int mCTimerHandler;
// //
// // EMA 200 ...
// int mEMA200Handler;
// double mEMA200Buffer[];
// //
// // RSI ...
// int mRSIHandler;
// double mRSIBuffer[];
//
// CCI ...
int mCCIHandler;
double mCCIBuffer[];
//
// Here we are Capture Conditions and Check Signals ...
// The Signals Must be Unique for each providers ...
void ProcessSignals()
{
//
XSignalInfo signal;
//
// BUY ...
//
Clean(signal);
bool hasLongSignal = HasLongSignal(signal);
if (hasLongSignal)
{
//
NotifyOnSignalEvent(
signal);
mWaitUntilNewCandle = true;
return;
}
//
// SELL ...
//
Clean(signal);
bool hasShortignal = HasShortSignal(signal);
if (hasShortignal)
{
//
NotifyOnSignalEvent(
signal);
mWaitUntilNewCandle = true;
return;
}
}
//
// START Providers Signals ...
//
//
// Check has Long Signal on Each Strategies ...
bool HasLongSignal(XSignalInfo &info)
{
//
bool result = false;
//
double entry = GetEntry(POSITION_TYPE_BUY);
//
bool isXMRBHasSignal = false; // XMRBHasLongCondition();
if (isXMRBHasSignal)
{
//
Add(
"XMRB",
info.providers);
//
info.r2r = 1.5;
//
// info.sl = mATRSLHelper.downBuffer[1];
}
//
bool isXPVHasSignal = false; // XPVHasLongCondition();
if (isXPVHasSignal)
{
//
Add(
"XPV",
info.providers);
//
info.r2r = 1.4;
//
double slValue = mPVHelper.sLLBuffer[1];
// slValue -= PointToPrice(
// mSymbol,
// 5
// );
// info.sl = slValue;
info.sl = mATRSLHelper.downBuffer[1];
}
//
bool isXICHIHasSignal1 = false; // XICHIHasLongCondition1();
if (isXICHIHasSignal1)
{
//
Add(
"XICHI",
info.providers);
//
info.r2r = 1.5;
//
double llValue = GetLowestLow(
mSymbol,
mPeriod,
3,
0);
llValue -= PointToPrice(
mSymbol,
5);
//
info.sl = llValue;
}
//
bool isXICHIHasSignal2 = false; // XICHIHasLongCondition2();
if (isXICHIHasSignal2)
{
//
Add(
"XICHI",
info.providers);
//
info.r2r = 1;
//
double llValue = GetLowestLow(
mSymbol,
mPeriod,
3,
0);
llValue -= PointToPrice(
mSymbol,
5);
//
info.sl = llValue;
}
//
bool isXICHIHasSignal3 = false; // XICHIHasLongCondition3();
if (isXICHIHasSignal3)
{
//
Add(
"XICHI",
info.providers);
//
info.r2r = 1.5;
//
double llValue = GetLowestLow(
mSymbol,
mPeriod,
3,
0);
llValue -= PointToPrice(
mSymbol,
5);
//
info.sl = llValue;
}
//
bool isXICHIHasSignal4 = XICHIHasLongCondition4();
if (isXICHIHasSignal4)
{
//
Add(
"XICHI",
info.providers);
//
info.r2r = 1.5;
//
double slValue = mATRSLHelper.downBuffer[1];
slValue -= PointToPrice(
mSymbol,
5);
//
info.sl = slValue;
}
//
result =
//
isXMRBHasSignal
//
||
//
isXPVHasSignal
//
||
//
isXICHIHasSignal1
//
||
//
isXICHIHasSignal2
//
||
//
isXICHIHasSignal3
//
||
//
isXICHIHasSignal4
//
;
//
if (result)
{
//
info.entry = entry;
info.symbol = mSymbol;
info.period = mPeriod;
info.type = POSITION_TYPE_BUY;
}
//
return result;
}
//
// Check has Short Signal on Each Strategies ...
bool HasShortSignal(XSignalInfo &info)
{
//
bool result = false;
//
double entry = GetEntry(POSITION_TYPE_SELL);
//
bool isXMRBHasSignal = false; // XMRBHasShortCondition();
if (isXMRBHasSignal)
{
//
Add(
"XMRB",
info.providers);
//
info.r2r = 1.5;
//
// info.sl = mATRSLHelper.upBuffer[1];
}
//
bool isXPVHasSignal = false; // XPVHasShortCondition();
if (isXPVHasSignal)
{
//
Add(
"XPV",
info.providers);
//
info.r2r = 1.4;
//
double slValue = mPVHelper.sHHBuffer[1];
// slValue -= PointToPrice(
// mSymbol,
// 5
// );
// info.sl = slValue;
info.sl = mATRSLHelper.upBuffer[1];
}
//
bool isXICHIHasSignal1 = false; // XICHIHasShortCondition1();
if (isXICHIHasSignal1)
{
//
Add(
"XICHI",
info.providers);
//
info.r2r = 1.5;
//
double hhValue = GetHighestHigh(
mSymbol,
mPeriod,
3,
0);
hhValue += PointToPrice(
mSymbol,
5);
//
info.sl = hhValue;
}
//
bool isXICHIHasSignal2 = false; // XICHIHasShortCondition2();
if (isXICHIHasSignal2)
{
//
Add(
"XICHI",
info.providers);
//
info.r2r = 1;
//
double hhValue = GetHighestHigh(
mSymbol,
mPeriod,
3,
0);
hhValue += PointToPrice(
mSymbol,
5);
//
info.sl = hhValue;
}
//
bool isXICHIHasSignal3 = false; // XICHIHasShortCondition3();
if (isXICHIHasSignal3)
{
//
Add(
"XICHI",
info.providers);
//
info.r2r = 1.5;
//
double hhValue = GetHighestHigh(
mSymbol,
mPeriod,
3,
0);
hhValue += PointToPrice(
mSymbol,
5);
//
info.sl = hhValue;
}
//
bool isXICHIHasSignal4 = XICHIHasShortCondition4();
if (isXICHIHasSignal4)
{
//
Add(
"XICHI",
info.providers);
//
info.r2r = 1.5;
//
double slValue = mATRSLHelper.upBuffer[1];
slValue += PointToPrice(
mSymbol,
5);
//
info.sl = slValue;
}
//
result =
//
isXMRBHasSignal
//
||
//
isXPVHasSignal
//
||
//
isXICHIHasSignal1
//
||
//
isXICHIHasSignal2
//
||
//
isXICHIHasSignal3
//
||
//
isXICHIHasSignal4
//
;
//
if (result)
{
//
info.entry = entry;
info.symbol = mSymbol;
info.period = mPeriod;
info.type = POSITION_TYPE_SELL;
}
//
return result;
}
//
// START XMRB ...
//
bool XMRBHasLongCondition()
{
//
bool result = false;
// //
// XOHCL c1 = GetCandle(
// mSymbol,
// mPeriod,
// 1);
// //
// XOHCL c2 = GetCandle(
// mSymbol,
// mPeriod,
// 2);
// //
// double hhValue = GetHighestHigh(
// mSymbol,
// mPeriod,
// 5,
// 1);
// double llValue = GetLowestLow(
// mSymbol,
// mPeriod,
// 5,
// 1);
// //
// // Find Fast Cross Over Slow ...
// bool isFastCrossOverSlow =
// mMRBHelper.fastBuffer[1] > mMRBHelper.slowBuffer[1] &&
// mMRBHelper.fastBuffer[2] <= mMRBHelper.slowBuffer[2];
// //
// bool isTrendsUp =
// //
// // Trens by Other ...
// (
// //
// (
// //
// mMRBHelper.fast1Buffer[1] > mMRBHelper.slow1Buffer[1] &&
// mMRBHelper.fast2Buffer[1] > mMRBHelper.slow2Buffer[1] &&
// mMRBHelper.fast3Buffer[1] > mMRBHelper.slow3Buffer[1] &&
// mMRBHelper.fast4Buffer[1] > mMRBHelper.slow4Buffer[1] &&
// mMRBHelper.fast5Buffer[1] > mMRBHelper.slow5Buffer[1]
// //
// )
// //
// ||
// (
// //
// mMRBHelper.fast1Buffer[1] > mMRBHelper.slow1Buffer[1] &&
// mMRBHelper.fast2Buffer[1] > mMRBHelper.slow2Buffer[1] &&
// mMRBHelper.fast3Buffer[1] > mMRBHelper.slow3Buffer[1] &&
// mMRBHelper.fast4Buffer[1] > mMRBHelper.slow4Buffer[1]
// //
// )
// //
// ||
// (
// //
// mMRBHelper.fast2Buffer[1] > mMRBHelper.slow2Buffer[1] &&
// mMRBHelper.fast3Buffer[1] > mMRBHelper.slow3Buffer[1] &&
// mMRBHelper.fast4Buffer[1] > mMRBHelper.slow4Buffer[1] &&
// mMRBHelper.fast5Buffer[1] > mMRBHelper.slow5Buffer[1]
// //
// )
// //
// )
// //
// &&
// //
// // Trends By Them ...
// (
// //
// (
// //
// mMRBHelper.fast2Buffer[1] > mMRBHelper.fast3Buffer[1] &&
// mMRBHelper.fast3Buffer[1] > mMRBHelper.fast4Buffer[1]
// //
// )
// //
// ||
// //
// (
// //
// mMRBHelper.fast3Buffer[1] > mMRBHelper.fast4Buffer[1] &&
// mMRBHelper.fast4Buffer[1] > mMRBHelper.fast5Buffer[1]
// //
// )
// //
// )
// //
// ;
// //
// bool isCyclesTrendsUp =
// (
// //
// mMRBHelper.fast1Buffer[1] > mMRBHelper.slow1Buffer[1] &&
// mMRBHelper.fast2Buffer[1] > mMRBHelper.slow2Buffer[1] &&
// mMRBHelper.fast3Buffer[1] > mMRBHelper.slow3Buffer[1] &&
// mMRBHelper.fast4Buffer[1] > mMRBHelper.slow4Buffer[1] &&
// mMRBHelper.fast5Buffer[1] > mMRBHelper.slow5Buffer[1]
// //
// )
// //
// &&
// //
// !(
// //
// mMRBHelper.fast1Buffer[2] > mMRBHelper.slow1Buffer[2] &&
// mMRBHelper.fast2Buffer[2] > mMRBHelper.slow2Buffer[2] &&
// mMRBHelper.fast3Buffer[2] > mMRBHelper.slow3Buffer[2] &&
// mMRBHelper.fast4Buffer[2] > mMRBHelper.slow4Buffer[2] &&
// mMRBHelper.fast5Buffer[2] > mMRBHelper.slow5Buffer[2]
// //
// )
// //
// ;
// //
// bool candleCrossEMA200 =
// c1.open < mEMA200Buffer[1] &&
// c1.close > mEMA200Buffer[1];
// //
// bool llCrossEMA200 =
// llValue < mEMA200Buffer[1] &&
// hhValue > mEMA200Buffer[1];
// //
// bool candlesPullBack =
// //
// (
// //
// mMRBHelper.fastBuffer[1] > mMRBHelper.slowBuffer[1] &&
// mMRBHelper.fastBuffer[2] > mMRBHelper.slowBuffer[2] &&
// mMRBHelper.fastBuffer[3] > mMRBHelper.slowBuffer[3] &&
// //
// mMRBHelper.fastBuffer[1] > mMRBHelper.fastBuffer[2] &&
// mMRBHelper.fastBuffer[2] > mMRBHelper.fastBuffer[3] &&
// //
// c1.open < mMRBHelper.fastBuffer[1] &&
// c1.close > mMRBHelper.fastBuffer[2] &&
// //
// c2.open < mMRBHelper.fastBuffer[2] &&
// c2.close < mMRBHelper.fastBuffer[2] &&
// //
// MathMin(c1.high, c1.low) > mEMA200Buffer[1] &&
// MathMin(c2.high, c2.low) > mEMA200Buffer[2]
// //
// )
// //
// ;
// //
// result =
// //
// (isTrendsUp &&
// llCrossEMA200 &&
// isFastCrossOverSlow)
// //
// ||
// //
// (isTrendsUp &&
// isCyclesTrendsUp &&
// candleCrossEMA200)
// //
// // ||
// // //
// // llCrossEMA200
// // //
// ||
// //
// candlesPullBack
// //
// ;
//
return result;
}
//
bool XMRBHasShortCondition()
{
//
bool result = false;
// //
// XOHCL c1 = GetCandle(
// mSymbol,
// mPeriod,
// 1);
// XOHCL c2 = GetCandle(
// mSymbol,
// mPeriod,
// 2);
// //
// double hhValue = GetHighestHigh(
// mSymbol,
// mPeriod,
// 5,
// 1);
// double llValue = GetLowestLow(
// mSymbol,
// mPeriod,
// 5,
// 1);
// //
// // Find Fast Cross Under Slow ...
// bool isFastCrossUnderSlow =
// mMRBHelper.fastBuffer[1] < mMRBHelper.slowBuffer[1] &&
// mMRBHelper.fastBuffer[2] >= mMRBHelper.slowBuffer[2];
// //
// bool isTrendsDown =
// //
// // Trens by Other ...
// (
// //
// (
// //
// mMRBHelper.fast1Buffer[1] < mMRBHelper.slow1Buffer[1] &&
// mMRBHelper.fast2Buffer[1] < mMRBHelper.slow2Buffer[1] &&
// mMRBHelper.fast3Buffer[1] < mMRBHelper.slow3Buffer[1] &&
// mMRBHelper.fast4Buffer[1] < mMRBHelper.slow4Buffer[1] &&
// mMRBHelper.fast5Buffer[1] < mMRBHelper.slow5Buffer[1]
// //
// )
// //
// ||
// (
// //
// mMRBHelper.fast1Buffer[1] < mMRBHelper.slow1Buffer[1] &&
// mMRBHelper.fast2Buffer[1] < mMRBHelper.slow2Buffer[1] &&
// mMRBHelper.fast3Buffer[1] < mMRBHelper.slow3Buffer[1] &&
// mMRBHelper.fast4Buffer[1] < mMRBHelper.slow4Buffer[1]
// //
// )
// //
// ||
// (
// //
// mMRBHelper.fast2Buffer[1] < mMRBHelper.slow2Buffer[1] &&
// mMRBHelper.fast3Buffer[1] < mMRBHelper.slow3Buffer[1] &&
// mMRBHelper.fast4Buffer[1] < mMRBHelper.slow4Buffer[1] &&
// mMRBHelper.fast5Buffer[1] < mMRBHelper.slow5Buffer[1]
// //
// )
// //
// )
// //
// &&
// //
// // Trends By Them ...
// (
// //
// (
// //
// mMRBHelper.fast2Buffer[1] < mMRBHelper.fast3Buffer[1] &&
// mMRBHelper.fast3Buffer[1] < mMRBHelper.fast4Buffer[1]
// //
// )
// //
// ||
// //
// (
// //
// mMRBHelper.fast3Buffer[1] < mMRBHelper.fast4Buffer[1] &&
// mMRBHelper.fast4Buffer[1] < mMRBHelper.fast5Buffer[1]
// //
// )
// //
// )
// //
// ;
// //
// bool isCyclesTrendsDown =
// (
// //
// mMRBHelper.fast1Buffer[1] < mMRBHelper.slow1Buffer[1] &&
// mMRBHelper.fast2Buffer[1] < mMRBHelper.slow2Buffer[1] &&
// mMRBHelper.fast3Buffer[1] < mMRBHelper.slow3Buffer[1] &&
// mMRBHelper.fast4Buffer[1] < mMRBHelper.slow4Buffer[1] &&
// mMRBHelper.fast5Buffer[1] < mMRBHelper.slow5Buffer[1]
// //
// )
// //
// &&
// //
// !(
// //
// mMRBHelper.fast1Buffer[2] < mMRBHelper.slow1Buffer[2] &&
// mMRBHelper.fast2Buffer[2] < mMRBHelper.slow2Buffer[2] &&
// mMRBHelper.fast3Buffer[2] < mMRBHelper.slow3Buffer[2] &&
// mMRBHelper.fast4Buffer[2] < mMRBHelper.slow4Buffer[2] &&
// mMRBHelper.fast5Buffer[2] < mMRBHelper.slow5Buffer[2]
// //
// )
// //
// ;
// //
// bool candleCrossEMA200 =
// c1.open > mEMA200Buffer[1] &&
// c1.close < mEMA200Buffer[1];
// //
// bool hhCrossEMA200 =
// hhValue > mEMA200Buffer[1] &&
// llValue < mEMA200Buffer[1];
// //
// bool candlesPullBack =
// //
// (
// //
// mMRBHelper.fastBuffer[1] < mMRBHelper.slowBuffer[1] &&
// mMRBHelper.fastBuffer[2] < mMRBHelper.slowBuffer[2] &&
// mMRBHelper.fastBuffer[3] < mMRBHelper.slowBuffer[3] &&
// //
// mMRBHelper.fastBuffer[1] < mMRBHelper.fastBuffer[2] &&
// mMRBHelper.fastBuffer[2] < mMRBHelper.fastBuffer[3] &&
// //
// c1.open > mMRBHelper.fastBuffer[1] &&
// c1.close < mMRBHelper.fastBuffer[2] &&
// //
// c2.open > mMRBHelper.slowBuffer[2] &&
// c2.close > mMRBHelper.slowBuffer[2] &&
// //
// MathMax(c1.high, c1.low) < mEMA200Buffer[1] &&
// MathMax(c2.high, c2.low) < mEMA200Buffer[2]
// //
// )
// //
// ;
// //
// result =
// //
// (isTrendsDown &&
// hhCrossEMA200 &&
// isFastCrossUnderSlow)
// //
// ||
// //
// (isTrendsDown &&
// isCyclesTrendsDown &&
// candleCrossEMA200)
// //
// // ||
// // //
// // hhCrossEMA200
// // //
// ||
// //
// candlesPullBack
// //
// ;
//
return result;
}
//
// END XMRB ...
//
//
// START XPV ...
//
//
bool XPVHasLongCondition()
{
//
bool result = false;
//
bool isSupportsHappens =
//
!mPVHelper.IsStrongSupport(1) &&
mPVHelper.IsStrongSupport(2) &&
mPVHelper.IsStrongSupport(3)
//
;
//
result =
//
false
//
// isSupportsHappens &&
// isFeautureKumoBullish
//
;
//
return result;
}
//
bool XPVHasShortCondition()
{
//
bool result = false;
//
result =
!mPVHelper.IsStrongResistance(1) &&
mPVHelper.IsStrongResistance(2) &&
mPVHelper.IsStrongResistance(3);
//
return result;
}
//
// END XPV ...
//
//
// START Ichimoku ...
//
//
// CONDITION 1 ...
//
// Long Condition 1 ...
bool XICHIHasLongCondition1()
{
//
bool result = false;
//
XOHCL c1 = GetCandle(
mSymbol,
mPeriod,
1);
//
bool isTenkanSenCrossed =
mIchiHelper.IsTenkanSenCrossedOverKijunSen(1);
//
XIchiInfo info = mIchiHelper.GetInfo(1);
bool isCandleClosedOverCross =
c1.close > MathMax(info.tenkanSen, info.kijunSen);
//
double ll = GetLowestLow(
mSymbol,
mPeriod,
6,
1);
bool isCandlesOverKumo =
ll > MathMax(info.senkouSpanA, info.senkouSpanB);
//
result =
//
isTenkanSenCrossed &&
isCandlesOverKumo &&
isCandleClosedOverCross
//
;
//
return result;
}
//
// Short Condition 1 ...
bool XICHIHasShortCondition1()
{
//
bool result = false;
//
XOHCL c1 = GetCandle(
mSymbol,
mPeriod,
1);
//
bool isTenkanSenCrossed =
mIchiHelper.IsTenkanSenCrossedUnderKijunSen(1);
//
XIchiInfo info = mIchiHelper.GetInfo(1);
bool isCandleClosedUnderCross =
c1.close < MathMin(info.tenkanSen, info.kijunSen);
//
double hh = GetHighestHigh(
mSymbol,
mPeriod,
6,
1);
bool isCandlesUnderKumo =
hh < MathMin(info.senkouSpanA, info.senkouSpanB);
//
result =
//
isTenkanSenCrossed &&
isCandlesUnderKumo &&
isCandleClosedUnderCross
//
;
//
return result;
}
//
// CONDITION 2 ...
//
// Long Condition 2 ...
// Ichimoku and CCI ...
bool XICHIHasLongCondition2()
{
//
bool result = false;
//
bool isCCICrossedOverNegative100 =
//
mCCIBuffer[1] > -100 &&
mCCIBuffer[2] <= -100
//
;
//
bool isTenkanSenOverKijunSen =
mIchiHelper.IsTenkanSenOverKijunSen(1);
//
bool isKumoBullish =
mIchiHelper.IsKumoBullish(1);
//
XIchiInfo info = mIchiHelper.GetInfo(1);
double llValue = GetLowestLow(
mSymbol,
mPeriod,
12,
1);
bool isPriceOverKumo =
//
llValue > MathMax(info.senkouSpanA, info.senkouSpanB)
//
;
//
result =
//
isKumoBullish &&
isPriceOverKumo &&
isTenkanSenOverKijunSen &&
isCCICrossedOverNegative100
//
;
//
return result;
}
//
// Short Condition 2 ...
// Ichimoku and CCI ...
bool XICHIHasShortCondition2()
{
//
bool result = false;
//
bool isCCICrossedUnderPositive100 =
//
mCCIBuffer[1] < 100 &&
mCCIBuffer[2] >= 100
//
;
//
bool isTenkanSenUnderKijunSen =
mIchiHelper.IsTenkanSenUnderKijunSen(1);
//
bool isKumoBearish =
mIchiHelper.IsKumoBearish(1);
//
XOHCL c1 = GetCandle(
mSymbol,
mPeriod,
1);
XIchiInfo info = mIchiHelper.GetInfo(1);
double hhValue = GetHighestHigh(
mSymbol,
mPeriod,
12,
1);
bool isPriceUnderKumo =
//
c1.high < MathMin(info.senkouSpanA, info.senkouSpanB) &&
hhValue < MathMin(info.senkouSpanA, info.senkouSpanB)
//
;
//
result =
//
isKumoBearish &&
isPriceUnderKumo &&
isTenkanSenUnderKijunSen &&
isCCICrossedUnderPositive100
//
;
//
return result;
}
//
// CONDITIONS 3 ...
//
// Long Condition 3 ...
bool XICHIHasLongCondition3()
{
//
bool result = false;
//
XOHCL c1 = GetCandle(
mSymbol,
mPeriod,
1);
//
XIchiInfo info = mIchiHelper.GetInfo(1);
//
bool isFutureKumoSwitchedToBullish =
mIchiHelper.IsKumoSwitchedToBullish(1, true);
//
bool isCandleClosedOverFutureKumo =
c1.close > MathMax(info.senkouSpanAFuture, info.senkouSpanBFuture);
//
result =
//
isCandleClosedOverFutureKumo &&
isFutureKumoSwitchedToBullish
//
;
//
return result;
}
//
// Short Condition 3 ...
bool XICHIHasShortCondition3()
{
//
bool result = false;
//
XOHCL c1 = GetCandle(
mSymbol,
mPeriod,
1);
//
XIchiInfo info = mIchiHelper.GetInfo(1);
//
bool isFutureKumoSwitchedToBearish =
mIchiHelper.IsKumoSwitchedToBearish(1, true);
//
bool isCandleClosedUnderFutureKumo =
c1.close < MathMin(info.senkouSpanAFuture, info.senkouSpanBFuture);
//
result =
//
isCandleClosedUnderFutureKumo &&
isFutureKumoSwitchedToBearish
//
;
//
return result;
}
//
// CONDITIONS 4 ...
//
// Long Condition 4 ...
bool XICHIHasLongCondition4()
{
//
bool result = false;
//
XOHCL c1 = GetCandle(
mSymbol,
mPeriod,
1);
//
XIchiInfo info = mIchiHelper.GetInfo(1);
//
bool isSSLUpCrossedOverDown =
mSSLCHelper.IsUpCrossedOverDown(1);
//
bool isCandleClosedOverKumo =
c1.low > MathMax(info.senkouSpanA, info.senkouSpanB);
//
bool isKumoBullish =
mIchiHelper.IsKumoBullish(1);
//
result =
//
isKumoBullish &&
isSSLUpCrossedOverDown &&
isCandleClosedOverKumo
//
;
//
return result;
}
//
// Short Condition 4 ...
bool XICHIHasShortCondition4()
{
//
bool result = false;
//
XOHCL c1 = GetCandle(
mSymbol,
mPeriod,
1);
//
XIchiInfo info = mIchiHelper.GetInfo(1);
//
bool isSSLUpCrossedUnderDown =
mSSLCHelper.IsUpCrossedUnderDown(1);
//
bool isCandleClosedUnderKumo =
c1.high < MathMin(info.senkouSpanA, info.senkouSpanB);
//
bool isKumoBearish =
mIchiHelper.IsKumoBearish(1);
//
result =
//
isKumoBearish &&
isSSLUpCrossedUnderDown &&
isCandleClosedUnderKumo
//
;
//
return result;
}
//
// END Ichimoku ...
//
//
// END Providers Signals ...
//
};
//
// START Definitions ...
//
//
// Model Signal Providers Definitions ...
struct X121SignalProvider
{
//
// Provider use Which Symbol ...
string symbol;
//
// Provider use Which Time Frame ...
ENUM_TIMEFRAMES period;
//
// Risk Amount Per Trades Related to Time Frames ...
// Percent of Available Balance ...
double riskAmount;
//
// Desired Magic Number ...
ulong magicNumber;
//
// Provider ...
XSCX121Provider provider;
};
//
// END Definitions ...
//
//
// START Usefull Functions ...
//
//
// Add Specific Provider to List ...
void Add(
X121SignalProvider &item, // item want to add
X121SignalProvider &buffer[] // Destination buffer
)
{
//
ArrayResize(
buffer,
ArraySize(buffer) + 1);
//
buffer[ArraySize(buffer) - 1] = item;
}
//
// Generate Identifier Tag ...
string GenerateTag(X121SignalProvider &descriptor)
{
//
string result = "";
//
result = descriptor.symbol + "_" + ToString(descriptor.period);
//
return result;
}
//
// END Usefull Functions ...
//