last ...
This commit is contained in:
@@ -28,9 +28,7 @@
|
||||
#include "../Helpers/x-saherelm.xcc.helper.mq5"
|
||||
|
||||
//
|
||||
#include "../Strategies/x-saherelm.xobvg.strategy.mq5"
|
||||
#include "../Strategies/x-saherelm.xsrbr.strategy.mq5"
|
||||
#include "../Strategies/x-saherelm.xemrng.strategy.mq5"
|
||||
#include "../Strategies/x-saherelm.xtest.strategy.mq5"
|
||||
|
||||
//
|
||||
// Inputs ...
|
||||
@@ -50,6 +48,10 @@ int eaMaxAllowedShorts = 0;
|
||||
double eaTPPoint = 200;
|
||||
double eaSLPoint = 100;
|
||||
|
||||
//
|
||||
bool eaIgnoreTP = false;
|
||||
bool eaIgnoreSL = false;
|
||||
|
||||
//
|
||||
double eaR2R = 2;
|
||||
|
||||
@@ -124,7 +126,11 @@ void OnDeinit(const int reason)
|
||||
// On Tick Handler ...
|
||||
void OnTick()
|
||||
{
|
||||
//
|
||||
HandleStrategiesOnTick();
|
||||
|
||||
//
|
||||
HandleTradeState();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -205,7 +211,9 @@ bool InitialEA()
|
||||
//
|
||||
bool useXSRBR = false;
|
||||
bool useXEMRNG = false;
|
||||
bool useXOBVG = true;
|
||||
bool useXOBVG = false;
|
||||
bool useXPVFMC = false;
|
||||
bool useXTest = true;
|
||||
|
||||
//
|
||||
// EURUSD ...
|
||||
@@ -217,381 +225,32 @@ bool InitialEA()
|
||||
long magicNumber = eaMagicNumber + 1;
|
||||
|
||||
//
|
||||
// XSRBR ...
|
||||
if (useXSRBR)
|
||||
// XTest ...
|
||||
if (useXTest)
|
||||
{
|
||||
//
|
||||
// Register XSRBR on EURUSD in M5 ...
|
||||
XSCXSRBRStrategy *eurusdM5SRBRStrategy;
|
||||
eurusdM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||
eurusdSymbol,
|
||||
PERIOD_M5,
|
||||
PERIOD_H1,
|
||||
eaVolume,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // 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,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts, // 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(
|
||||
XSCXTestStrategy *eurusdTestStrategy;
|
||||
eurusdTestStrategy = new XSCXTestStrategy(
|
||||
eurusdSymbol,
|
||||
PERIOD_M5,
|
||||
eaVolume,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
100, // eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaIgnoreTP,
|
||||
true, // eaIgnoreSL,
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts // Max Shorts
|
||||
);
|
||||
eurusdM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||
eurusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(eurusdM5EMRNGStrategy);
|
||||
}
|
||||
|
||||
//
|
||||
// XOBVG ...
|
||||
if (useXOBVG)
|
||||
{
|
||||
//
|
||||
XSCXOBVGStrategy *eurusdM5OBVGStrategy;
|
||||
eurusdM5OBVGStrategy = new XSCXOBVGStrategy(
|
||||
eurusdSymbol,
|
||||
PERIOD_M5,
|
||||
PERIOD_H2, // Analyzing Period
|
||||
eaVolume,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
false, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts // Max Shorts
|
||||
);
|
||||
eurusdM5OBVGStrategy.SetAlertLogAlerts(true);
|
||||
eurusdM5OBVGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(eurusdM5OBVGStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// USDCHF ...
|
||||
string usdchfSymbol = "USDCHFb";
|
||||
if (useUSDCHF && IsValid(usdchfSymbol))
|
||||
{
|
||||
//
|
||||
// MAGIC NUMBER ...
|
||||
long magicNumber = eaMagicNumber + 2;
|
||||
|
||||
//
|
||||
// XSRBR ...
|
||||
if (useXSRBR)
|
||||
{
|
||||
//
|
||||
// Register XSRBR on EURUSD in M5 ...
|
||||
XSCXSRBRStrategy *usdchfM5SRBRStrategy;
|
||||
usdchfM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||
usdchfSymbol,
|
||||
PERIOD_M5,
|
||||
PERIOD_H1,
|
||||
eaVolume,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts, // 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,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts // Max Shorts
|
||||
);
|
||||
usdchfM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||
usdchfM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(usdchfM5EMRNGStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// USDJPY ...
|
||||
string usdjpySymbol = "USDJPYb";
|
||||
if (useUSDJPY && IsValid(usdjpySymbol))
|
||||
{
|
||||
//
|
||||
// MAGIC NUMBER ...
|
||||
long magicNumber = eaMagicNumber + 3;
|
||||
|
||||
//
|
||||
// XSRBR ...
|
||||
if (useXSRBR)
|
||||
{
|
||||
//
|
||||
// Register XSRBR on EURUSD in M5 ...
|
||||
XSCXSRBRStrategy *usdjpyM5SRBRStrategy;
|
||||
usdjpyM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||
usdjpySymbol,
|
||||
PERIOD_M5,
|
||||
PERIOD_M30,
|
||||
eaVolume,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts, // 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,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts // Max Shorts
|
||||
);
|
||||
usdjpyM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||
usdjpyM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(usdjpyM5EMRNGStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// GBPUSD ...
|
||||
string gbpusdSymbol = "GBPUSDb";
|
||||
if (useGBPUSD && IsValid(gbpusdSymbol))
|
||||
{
|
||||
//
|
||||
// MAGIC NUMBER ...
|
||||
long magicNumber = eaMagicNumber + 4;
|
||||
|
||||
//
|
||||
// XSRBR ...
|
||||
if (useXSRBR)
|
||||
{
|
||||
//
|
||||
// Register XSRBR on EURUSD in M5 ...
|
||||
XSCXSRBRStrategy *gbpusdM5SRBRStrategy;
|
||||
gbpusdM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||
gbpusdSymbol,
|
||||
PERIOD_M5,
|
||||
PERIOD_H1,
|
||||
eaVolume,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts, // 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,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts // Max Shorts
|
||||
);
|
||||
gbpusdM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||
gbpusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(gbpusdM5EMRNGStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// XAUUSD ...
|
||||
string xauusdSymbol = "XAUUSDb";
|
||||
if (useXAUUSD && IsValid(xauusdSymbol))
|
||||
{
|
||||
//
|
||||
// MAGIC NUMBER ...
|
||||
long magicNumber = eaMagicNumber + 5;
|
||||
|
||||
//
|
||||
// XSRBR ...
|
||||
if (useXSRBR)
|
||||
{
|
||||
//
|
||||
// Register XSRBR on EURUSD in M5 ...
|
||||
XSCXSRBRStrategy *xauusdM5SRBRStrategy;
|
||||
xauusdM5SRBRStrategy = new XSCXSRBRStrategy(
|
||||
xauusdSymbol,
|
||||
PERIOD_M15,
|
||||
PERIOD_M30,
|
||||
eaVolume,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts, // 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,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
true, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts // Max Shorts
|
||||
);
|
||||
xauusdM5EMRNGStrategy.SetAlertLogAlerts(true);
|
||||
xauusdM5EMRNGStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(xauusdM5EMRNGStrategy);
|
||||
eurusdTestStrategy.SetAlertLogAlerts(true);
|
||||
eurusdTestStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(eurusdTestStrategy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,6 +298,13 @@ void HandleStrategiesOnTick()
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
void HandleTradeState()
|
||||
{
|
||||
//
|
||||
// Implement All Trade States here ...
|
||||
}
|
||||
|
||||
//
|
||||
// Custom Testing Functions ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user