This commit is contained in:
2024-07-18 09:58:29 +03:30
parent b4bc3774b0
commit 57affb201e
4 changed files with 603 additions and 71 deletions
+355 -71
View File
@@ -26,7 +26,10 @@
// Imports ...
#include "../Helpers/x-saherelm.xct.helper.mq5"
#include "../Helpers/x-saherelm.xcc.helper.mq5"
//
#include "../Strategies/x-saherelm.xsrbr.strategy.mq5"
#include "../Strategies/x-saherelm.xemrng.strategy.mq5"
//
// Inputs ...
@@ -177,99 +180,380 @@ bool InitialEA()
//
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 ...
string eurusdSymbol = "EURUSDb"; // symbolParser.GetEURUSDSymbol();
if (IsValid(eurusdSymbol))
if (useEURUSD && IsValid(eurusdSymbol))
{
//
// MAGIC NUMBER ...
long magicNumber = mMagicNumber + 1;
//
// Register XSRBR on EURUSD in M5 ...
XSCXSRBRStrategy *eurusdM5SRBRStrategy;
eurusdM5SRBRStrategy = new XSCXSRBRStrategy(
eurusdSymbol,
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 //
);
eurusdM5SRBRStrategy.SetAlertLogAlerts(true);
eurusdM5SRBRStrategy.SetAlertEnableAlerts(true);
RegisterStrategy(eurusdM5SRBRStrategy);
// XSRBR ...
if (useXSRBR)
{
//
// Register XSRBR on EURUSD in M5 ...
XSCXSRBRStrategy *eurusdM5SRBRStrategy;
eurusdM5SRBRStrategy = new XSCXSRBRStrategy(
eurusdSymbol,
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 //
);
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 ...
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);
// XEMRNG ...
if (useXEMRNG)
{
//
XSCXEMRNGStrategy *eurusdM5EMRNGStrategy;
eurusdM5EMRNGStrategy = new XSCXEMRNGStrategy(
eurusdSymbol,
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 //
);
eurusdM5EMRNGStrategy.SetAlertLogAlerts(true);
eurusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
RegisterStrategy(eurusdM5EMRNGStrategy);
}
}
//
// USDCHF ...
string usdchfSymbol = "USDCHFb";
if (IsValid(usdchfSymbol))
if (useUSDCHF && IsValid(usdchfSymbol))
{
//
// MAGIC NUMBER ...
long magicNumber = mMagicNumber + 2;
//
// Register XSRBR on EURUSD in M5 ...
XSCXSRBRStrategy *usdchfM5SRBRStrategy;
usdchfM5SRBRStrategy = new XSCXSRBRStrategy(
usdchfSymbol,
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 //
);
usdchfM5SRBRStrategy.SetAlertLogAlerts(true);
usdchfM5SRBRStrategy.SetAlertEnableAlerts(true);
RegisterStrategy(usdchfM5SRBRStrategy);
// XSRBR ...
if (useXSRBR)
{
//
// Register XSRBR on EURUSD in M5 ...
XSCXSRBRStrategy *usdchfM5SRBRStrategy;
usdchfM5SRBRStrategy = new XSCXSRBRStrategy(
usdchfSymbol,
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 //
);
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);
}
}
//