last ...
This commit is contained in:
@@ -26,7 +26,10 @@
|
|||||||
// Imports ...
|
// Imports ...
|
||||||
#include "../Helpers/x-saherelm.xct.helper.mq5"
|
#include "../Helpers/x-saherelm.xct.helper.mq5"
|
||||||
#include "../Helpers/x-saherelm.xcc.helper.mq5"
|
#include "../Helpers/x-saherelm.xcc.helper.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
#include "../Strategies/x-saherelm.xsrbr.strategy.mq5"
|
#include "../Strategies/x-saherelm.xsrbr.strategy.mq5"
|
||||||
|
#include "../Strategies/x-saherelm.xemrng.strategy.mq5"
|
||||||
|
|
||||||
//
|
//
|
||||||
// Inputs ...
|
// Inputs ...
|
||||||
@@ -177,99 +180,380 @@ bool InitialEA()
|
|||||||
//
|
//
|
||||||
bool drawAreas = false;
|
bool drawAreas = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool useEURUSD = true;
|
||||||
|
bool useUSDCHF = false;
|
||||||
|
bool useUSDJPY = false;
|
||||||
|
bool useGBPUSD = false;
|
||||||
|
bool useXAUUSD = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
bool useXSRBR = false;
|
||||||
|
bool useXEMRNG = true;
|
||||||
|
|
||||||
//
|
//
|
||||||
// EURUSD ...
|
// EURUSD ...
|
||||||
string eurusdSymbol = "EURUSDb"; // symbolParser.GetEURUSDSymbol();
|
string eurusdSymbol = "EURUSDb"; // symbolParser.GetEURUSDSymbol();
|
||||||
if (IsValid(eurusdSymbol))
|
if (useEURUSD && IsValid(eurusdSymbol))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// MAGIC NUMBER ...
|
// MAGIC NUMBER ...
|
||||||
long magicNumber = mMagicNumber + 1;
|
long magicNumber = mMagicNumber + 1;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register XSRBR on EURUSD in M5 ...
|
// XSRBR ...
|
||||||
XSCXSRBRStrategy *eurusdM5SRBRStrategy;
|
if (useXSRBR)
|
||||||
eurusdM5SRBRStrategy = new XSCXSRBRStrategy(
|
{
|
||||||
eurusdSymbol,
|
//
|
||||||
PERIOD_M5,
|
// Register XSRBR on EURUSD in M5 ...
|
||||||
PERIOD_H1,
|
XSCXSRBRStrategy *eurusdM5SRBRStrategy;
|
||||||
eaVolume,
|
eurusdM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||||
1.5, // R2R ...
|
eurusdSymbol,
|
||||||
mSlippage,
|
PERIOD_M5,
|
||||||
magicNumber,
|
PERIOD_H1,
|
||||||
true, // Use TP SL Point
|
eaVolume,
|
||||||
false, // Use Max
|
1.5, // R2R ...
|
||||||
200, // TP
|
mSlippage,
|
||||||
100, // SL
|
magicNumber,
|
||||||
eaAllowLong,
|
true, // Use TP SL Point
|
||||||
eaAllowShort,
|
false, // Use Max
|
||||||
0, // Max Longs
|
200, // TP
|
||||||
0, // Max Shorts
|
100, // SL
|
||||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
eaAllowLong,
|
||||||
);
|
eaAllowShort,
|
||||||
eurusdM5SRBRStrategy.SetAlertLogAlerts(true);
|
0, // Max Longs
|
||||||
eurusdM5SRBRStrategy.SetAlertEnableAlerts(true);
|
0, // Max Shorts
|
||||||
RegisterStrategy(eurusdM5SRBRStrategy);
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
|
);
|
||||||
|
eurusdM5SRBRStrategy.SetAlertLogAlerts(true);
|
||||||
|
eurusdM5SRBRStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(eurusdM5SRBRStrategy);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Register XSRBR on EURUSD in M5 ...
|
||||||
|
XSCXSRBRStrategy *eurusdM15SRBRStrategy;
|
||||||
|
eurusdM15SRBRStrategy = new XSCXSRBRStrategy(
|
||||||
|
eurusdSymbol,
|
||||||
|
PERIOD_M15,
|
||||||
|
PERIOD_M30,
|
||||||
|
eaVolume,
|
||||||
|
1.5, // R2R ...
|
||||||
|
mSlippage,
|
||||||
|
magicNumber,
|
||||||
|
true, // Use TP SL Point
|
||||||
|
false, // Use Max
|
||||||
|
200, // TP
|
||||||
|
100, // SL
|
||||||
|
eaAllowLong,
|
||||||
|
eaAllowShort,
|
||||||
|
0, // Max Longs
|
||||||
|
0, // Max Shorts
|
||||||
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
|
);
|
||||||
|
eurusdM15SRBRStrategy.SetAlertLogAlerts(true);
|
||||||
|
eurusdM15SRBRStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(eurusdM15SRBRStrategy);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register XSRBR on EURUSD in M5 ...
|
// XEMRNG ...
|
||||||
XSCXSRBRStrategy *eurusdM15SRBRStrategy;
|
if (useXEMRNG)
|
||||||
eurusdM15SRBRStrategy = new XSCXSRBRStrategy(
|
{
|
||||||
eurusdSymbol,
|
//
|
||||||
PERIOD_M15,
|
XSCXEMRNGStrategy *eurusdM5EMRNGStrategy;
|
||||||
PERIOD_M30,
|
eurusdM5EMRNGStrategy = new XSCXEMRNGStrategy(
|
||||||
eaVolume,
|
eurusdSymbol,
|
||||||
1.5, // R2R ...
|
PERIOD_M5,
|
||||||
mSlippage,
|
eaVolume,
|
||||||
magicNumber,
|
1.5, // R2R ...
|
||||||
true, // Use TP SL Point
|
mSlippage,
|
||||||
false, // Use Max
|
magicNumber,
|
||||||
200, // TP
|
true, // Use TP SL Point
|
||||||
100, // SL
|
false, // Use Max
|
||||||
eaAllowLong,
|
200, // TP
|
||||||
eaAllowShort,
|
100, // SL
|
||||||
0, // Max Longs
|
eaAllowLong,
|
||||||
0, // Max Shorts
|
eaAllowShort,
|
||||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
0, // Max Longs
|
||||||
);
|
0, // Max Shorts
|
||||||
eurusdM15SRBRStrategy.SetAlertLogAlerts(true);
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
eurusdM15SRBRStrategy.SetAlertEnableAlerts(true);
|
);
|
||||||
RegisterStrategy(eurusdM15SRBRStrategy);
|
eurusdM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||||
|
eurusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(eurusdM5EMRNGStrategy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// USDCHF ...
|
// USDCHF ...
|
||||||
string usdchfSymbol = "USDCHFb";
|
string usdchfSymbol = "USDCHFb";
|
||||||
if (IsValid(usdchfSymbol))
|
if (useUSDCHF && IsValid(usdchfSymbol))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// MAGIC NUMBER ...
|
// MAGIC NUMBER ...
|
||||||
long magicNumber = mMagicNumber + 2;
|
long magicNumber = mMagicNumber + 2;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Register XSRBR on EURUSD in M5 ...
|
// XSRBR ...
|
||||||
XSCXSRBRStrategy *usdchfM5SRBRStrategy;
|
if (useXSRBR)
|
||||||
usdchfM5SRBRStrategy = new XSCXSRBRStrategy(
|
{
|
||||||
usdchfSymbol,
|
//
|
||||||
PERIOD_M5,
|
// Register XSRBR on EURUSD in M5 ...
|
||||||
PERIOD_H1,
|
XSCXSRBRStrategy *usdchfM5SRBRStrategy;
|
||||||
eaVolume,
|
usdchfM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||||
1.5, // R2R ...
|
usdchfSymbol,
|
||||||
mSlippage,
|
PERIOD_M5,
|
||||||
magicNumber,
|
PERIOD_H1,
|
||||||
true, // Use TP SL Point
|
eaVolume,
|
||||||
false, // Use Max
|
1.5, // R2R ...
|
||||||
200, // TP
|
mSlippage,
|
||||||
100, // SL
|
magicNumber,
|
||||||
eaAllowLong,
|
true, // Use TP SL Point
|
||||||
eaAllowShort,
|
false, // Use Max
|
||||||
0, // Max Longs
|
200, // TP
|
||||||
0, // Max Shorts
|
100, // SL
|
||||||
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
eaAllowLong,
|
||||||
);
|
eaAllowShort,
|
||||||
usdchfM5SRBRStrategy.SetAlertLogAlerts(true);
|
0, // Max Longs
|
||||||
usdchfM5SRBRStrategy.SetAlertEnableAlerts(true);
|
0, // Max Shorts
|
||||||
RegisterStrategy(usdchfM5SRBRStrategy);
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
|
);
|
||||||
|
usdchfM5SRBRStrategy.SetAlertLogAlerts(true);
|
||||||
|
usdchfM5SRBRStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(usdchfM5SRBRStrategy);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XEMRNG ...
|
||||||
|
if (useXEMRNG)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XSCXEMRNGStrategy *usdchfM5EMRNGStrategy;
|
||||||
|
usdchfM5EMRNGStrategy = new XSCXEMRNGStrategy(
|
||||||
|
usdchfSymbol,
|
||||||
|
PERIOD_M5,
|
||||||
|
eaVolume,
|
||||||
|
1.5, // R2R ...
|
||||||
|
mSlippage,
|
||||||
|
magicNumber,
|
||||||
|
true, // Use TP SL Point
|
||||||
|
false, // Use Max
|
||||||
|
200, // TP
|
||||||
|
100, // SL
|
||||||
|
eaAllowLong,
|
||||||
|
eaAllowShort,
|
||||||
|
0, // Max Longs
|
||||||
|
0, // Max Shorts
|
||||||
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
|
);
|
||||||
|
usdchfM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||||
|
usdchfM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(usdchfM5EMRNGStrategy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// USDJPY ...
|
||||||
|
string usdjpySymbol = "USDJPYb";
|
||||||
|
if (useUSDJPY && IsValid(usdjpySymbol))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// MAGIC NUMBER ...
|
||||||
|
long magicNumber = mMagicNumber + 3;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XSRBR ...
|
||||||
|
if (useXSRBR)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Register XSRBR on EURUSD in M5 ...
|
||||||
|
XSCXSRBRStrategy *usdjpyM5SRBRStrategy;
|
||||||
|
usdjpyM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||||
|
usdjpySymbol,
|
||||||
|
PERIOD_M5,
|
||||||
|
PERIOD_M30,
|
||||||
|
eaVolume,
|
||||||
|
1.5, // R2R ...
|
||||||
|
mSlippage,
|
||||||
|
magicNumber,
|
||||||
|
true, // Use TP SL Point
|
||||||
|
false, // Use Max
|
||||||
|
200, // TP
|
||||||
|
100, // SL
|
||||||
|
eaAllowLong,
|
||||||
|
eaAllowShort,
|
||||||
|
0, // Max Longs
|
||||||
|
0, // Max Shorts
|
||||||
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
|
);
|
||||||
|
usdjpyM5SRBRStrategy.SetAlertLogAlerts(true);
|
||||||
|
usdjpyM5SRBRStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(usdjpyM5SRBRStrategy);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XEMRNG ...
|
||||||
|
if (useXEMRNG)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XSCXEMRNGStrategy *usdjpyM5EMRNGStrategy;
|
||||||
|
usdjpyM5EMRNGStrategy = new XSCXEMRNGStrategy(
|
||||||
|
usdjpySymbol,
|
||||||
|
PERIOD_M5,
|
||||||
|
eaVolume,
|
||||||
|
1.5, // R2R ...
|
||||||
|
mSlippage,
|
||||||
|
magicNumber,
|
||||||
|
true, // Use TP SL Point
|
||||||
|
false, // Use Max
|
||||||
|
200, // TP
|
||||||
|
100, // SL
|
||||||
|
eaAllowLong,
|
||||||
|
eaAllowShort,
|
||||||
|
0, // Max Longs
|
||||||
|
0, // Max Shorts
|
||||||
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
|
);
|
||||||
|
usdjpyM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||||
|
usdjpyM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(usdjpyM5EMRNGStrategy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// GBPUSD ...
|
||||||
|
string gbpusdSymbol = "GBPUSDb";
|
||||||
|
if (useGBPUSD && IsValid(gbpusdSymbol))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// MAGIC NUMBER ...
|
||||||
|
long magicNumber = mMagicNumber + 4;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XSRBR ...
|
||||||
|
if (useXSRBR)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Register XSRBR on EURUSD in M5 ...
|
||||||
|
XSCXSRBRStrategy *gbpusdM5SRBRStrategy;
|
||||||
|
gbpusdM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||||
|
gbpusdSymbol,
|
||||||
|
PERIOD_M5,
|
||||||
|
PERIOD_H1,
|
||||||
|
eaVolume,
|
||||||
|
1.5, // R2R ...
|
||||||
|
mSlippage,
|
||||||
|
magicNumber,
|
||||||
|
true, // Use TP SL Point
|
||||||
|
false, // Use Max
|
||||||
|
200, // TP
|
||||||
|
100, // SL
|
||||||
|
eaAllowLong,
|
||||||
|
eaAllowShort,
|
||||||
|
0, // Max Longs
|
||||||
|
0, // Max Shorts
|
||||||
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
|
);
|
||||||
|
gbpusdM5SRBRStrategy.SetAlertLogAlerts(true);
|
||||||
|
gbpusdM5SRBRStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(gbpusdM5SRBRStrategy);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XEMRNG ...
|
||||||
|
if (useXEMRNG)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XSCXEMRNGStrategy *gbpusdM5EMRNGStrategy;
|
||||||
|
gbpusdM5EMRNGStrategy = new XSCXEMRNGStrategy(
|
||||||
|
gbpusdSymbol,
|
||||||
|
PERIOD_M5,
|
||||||
|
eaVolume,
|
||||||
|
1.5, // R2R ...
|
||||||
|
mSlippage,
|
||||||
|
magicNumber,
|
||||||
|
true, // Use TP SL Point
|
||||||
|
false, // Use Max
|
||||||
|
200, // TP
|
||||||
|
100, // SL
|
||||||
|
eaAllowLong,
|
||||||
|
eaAllowShort,
|
||||||
|
0, // Max Longs
|
||||||
|
0, // Max Shorts
|
||||||
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
|
);
|
||||||
|
gbpusdM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||||
|
gbpusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(gbpusdM5EMRNGStrategy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XAUUSD ...
|
||||||
|
string xauusdSymbol = "XAUUSDb";
|
||||||
|
if (useXAUUSD && IsValid(xauusdSymbol))
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// MAGIC NUMBER ...
|
||||||
|
long magicNumber = mMagicNumber + 5;
|
||||||
|
|
||||||
|
//
|
||||||
|
// XSRBR ...
|
||||||
|
if (useXSRBR)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Register XSRBR on EURUSD in M5 ...
|
||||||
|
XSCXSRBRStrategy *xauusdM5SRBRStrategy;
|
||||||
|
xauusdM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||||
|
xauusdSymbol,
|
||||||
|
PERIOD_M15,
|
||||||
|
PERIOD_M30,
|
||||||
|
eaVolume,
|
||||||
|
1.5, // R2R ...
|
||||||
|
mSlippage,
|
||||||
|
magicNumber,
|
||||||
|
true, // Use TP SL Point
|
||||||
|
false, // Use Max
|
||||||
|
200, // TP
|
||||||
|
100, // SL
|
||||||
|
eaAllowLong,
|
||||||
|
eaAllowShort,
|
||||||
|
0, // Max Longs
|
||||||
|
0, // Max Shorts
|
||||||
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
|
);
|
||||||
|
xauusdM5SRBRStrategy.SetAlertLogAlerts(true);
|
||||||
|
xauusdM5SRBRStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(xauusdM5SRBRStrategy);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// XEMRNG ...
|
||||||
|
if (useXEMRNG)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
XSCXEMRNGStrategy *xauusdM5EMRNGStrategy;
|
||||||
|
xauusdM5EMRNGStrategy = new XSCXEMRNGStrategy(
|
||||||
|
xauusdSymbol,
|
||||||
|
PERIOD_M5,
|
||||||
|
eaVolume,
|
||||||
|
1.5, // R2R ...
|
||||||
|
mSlippage,
|
||||||
|
magicNumber,
|
||||||
|
true, // Use TP SL Point
|
||||||
|
false, // Use Max
|
||||||
|
200, // TP
|
||||||
|
100, // SL
|
||||||
|
eaAllowLong,
|
||||||
|
eaAllowShort,
|
||||||
|
0, // Max Longs
|
||||||
|
0, // Max Shorts
|
||||||
|
X_SIGNALLING_BOTH_DIRECTIONS // X_SIGNALIING_TREND_REVERSAL_DIRECTION // X_SIGNALLING_BOTH_DIRECTIONS //
|
||||||
|
);
|
||||||
|
xauusdM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||||
|
xauusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||||
|
RegisterStrategy(xauusdM5EMRNGStrategy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -2265,6 +2265,72 @@ struct XOHCL
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bullish Marubozu ...
|
||||||
|
bool IsBullishMarubozu()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid() && Index() > 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsBullish();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
GetUp() == high &&
|
||||||
|
GetDown() == low
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Bearish Marubozu ...
|
||||||
|
bool IsBearishMarubozu()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsValid() && Index() > 0;
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = IsBearish();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result =
|
||||||
|
//
|
||||||
|
GetUp() == high &&
|
||||||
|
GetDown() == low
|
||||||
|
//
|
||||||
|
;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Contextual Patterns ...
|
// Contextual Patterns ...
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,170 @@
|
|||||||
|
///////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// SaherElm IT Center MQL5 Class Library
|
||||||
|
// --------------------------------------
|
||||||
|
// Name: XSCXEMRNGStrategy
|
||||||
|
// Description: provides all based classes for use ...
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
|
||||||
|
//
|
||||||
|
/// Imports ...
|
||||||
|
#include "../Helpers/x-saherelm.xtm.helper.mq5"
|
||||||
|
#include "../Classes/x-saherelm.xstrategy.class.mq5"
|
||||||
|
|
||||||
|
//
|
||||||
|
string XEMRNGStartegyToken = "XEMRNG";
|
||||||
|
|
||||||
|
//
|
||||||
|
class XSCXEMRNGStrategy : public XSCBaseStrategy
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Public ...
|
||||||
|
public:
|
||||||
|
//
|
||||||
|
// Constructor(s) ...
|
||||||
|
void XSCXEMRNGStrategy(
|
||||||
|
//
|
||||||
|
// Base ...
|
||||||
|
string _symbol, // Trading Symbol
|
||||||
|
ENUM_TIMEFRAMES _period, // Trading TimeFrame
|
||||||
|
double _volume, // Voluem
|
||||||
|
double _r2r, // Risk/Reward Ratio
|
||||||
|
int _slippage, // Trader Slippage
|
||||||
|
long _magicNumber, // Trader Magic Number
|
||||||
|
bool _useTPSLAsPoint = false, // Converts TP and SL by Provided Points
|
||||||
|
bool _forceMaxTPSLAsPoint = false, // Force Max TP and SL by Provided Points
|
||||||
|
double _tpPoint = 0, // TP As Point
|
||||||
|
double _slPoint = 0, // SL As Point
|
||||||
|
bool _allowLong = true,
|
||||||
|
bool _allowShort = true,
|
||||||
|
int _maxAllowedLongs = 0,
|
||||||
|
int _maxAllowedShorts = 0,
|
||||||
|
ENUM_X_SIGNALLING_DIRECTION _signallingDirection = X_SIGNALLING_TREND_DIRECTION // Signalling in Which Direction
|
||||||
|
) : XSCBaseStrategy(_symbol,
|
||||||
|
_period,
|
||||||
|
_volume,
|
||||||
|
_r2r,
|
||||||
|
_slippage,
|
||||||
|
_magicNumber,
|
||||||
|
_useTPSLAsPoint,
|
||||||
|
_forceMaxTPSLAsPoint,
|
||||||
|
_tpPoint,
|
||||||
|
_slPoint,
|
||||||
|
_allowLong,
|
||||||
|
_allowShort,
|
||||||
|
_maxAllowedLongs,
|
||||||
|
_maxAllowedShorts //
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mSignallingDirection = _signallingDirection;
|
||||||
|
|
||||||
|
//
|
||||||
|
ConfigureTMInputs();
|
||||||
|
|
||||||
|
//
|
||||||
|
SetAlertPrefix(GetTag());
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Deconstructor ...
|
||||||
|
void ~XSCXEMRNGStrategy()
|
||||||
|
{
|
||||||
|
delete mTMHelper;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Getter / Setter (s) ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_SIGNALLING_DIRECTION SignallingDirection()
|
||||||
|
{
|
||||||
|
return mSignallingDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void SignallingDirection(ENUM_X_SIGNALLING_DIRECTION value)
|
||||||
|
{
|
||||||
|
mSignallingDirection = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Overrides ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Customize Strategy Identifier ...
|
||||||
|
string GetTag() override
|
||||||
|
{
|
||||||
|
return XEMRNGStartegyToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Conditions For Signal ...
|
||||||
|
bool HasSignal(
|
||||||
|
XSignal &signal //
|
||||||
|
) override
|
||||||
|
{
|
||||||
|
//
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Protected ...
|
||||||
|
protected:
|
||||||
|
//
|
||||||
|
// Props ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_SIGNALLING_DIRECTION mSignallingDirection; // Signalling Direction
|
||||||
|
|
||||||
|
//
|
||||||
|
XTMInputs mTMInputs; // Tren Magic Inputs ...
|
||||||
|
XSCXTMHelper *mTMHelper; // Trend Magic Helper Class ...
|
||||||
|
|
||||||
|
//
|
||||||
|
// Private ...
|
||||||
|
private:
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set Default TM Inputs ...
|
||||||
|
void ConfigureTMInputs()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
mTMInputs.maShift = 0;
|
||||||
|
mTMInputs.maPeriod = 100;
|
||||||
|
mTMInputs.maMethod = MODE_EMA;
|
||||||
|
mTMInputs.maAppliedTo = PRICE_CLOSE;
|
||||||
|
|
||||||
|
//
|
||||||
|
mTMInputs.showLine = true;
|
||||||
|
|
||||||
|
//
|
||||||
|
mTMHelper = new XSCXTMHelper();
|
||||||
|
|
||||||
|
//
|
||||||
|
mTMHelper.Init(
|
||||||
|
mSymbol,
|
||||||
|
mPeriod,
|
||||||
|
mTMInputs //
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
@@ -80,6 +80,18 @@ public:
|
|||||||
//
|
//
|
||||||
// Getter / Setter (s) ...
|
// Getter / Setter (s) ...
|
||||||
|
|
||||||
|
//
|
||||||
|
ENUM_X_SIGNALLING_DIRECTION SignallingDirection()
|
||||||
|
{
|
||||||
|
return mSignallingDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
void SignallingDirection(ENUM_X_SIGNALLING_DIRECTION value)
|
||||||
|
{
|
||||||
|
mSignallingDirection = value;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides ...
|
// Overrides ...
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user