last ...
This commit is contained in:
@@ -5846,3 +5846,927 @@ int pivotsCount = ArraySize(pivots);
|
||||
// sl = tmpHSW[ArraySize(tmpHSW) - 1].high;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// hasLong =
|
||||
// //
|
||||
// // Must in Bullish Trend ...
|
||||
// // isBullishTrend
|
||||
// // //
|
||||
// // &&
|
||||
// //
|
||||
// // Check Bar Patterns ...
|
||||
// // (
|
||||
// // //
|
||||
// // isHammer
|
||||
// // //
|
||||
// // ||
|
||||
// // //
|
||||
// // isMorningStar
|
||||
// // //
|
||||
// // ||
|
||||
// // //
|
||||
// // isBullishMarubozu
|
||||
// // //
|
||||
// // ||
|
||||
// // //
|
||||
// // isBullishEngulfing
|
||||
// // //
|
||||
// // )
|
||||
// // //
|
||||
// // &&
|
||||
// //
|
||||
// // Fib3 must below mc verifier ...
|
||||
// pvConditions.fib3s[ppIndex] < mcConditions.verifier[ppIndex] &&
|
||||
// pvConditions.fib3s[pIndex] < mcConditions.verifier[pIndex]
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// // Sar Must be Bullish ...
|
||||
// mcConditions.psar[ppIndex] < ppBar.low &&
|
||||
// mcConditions.psar[pIndex] < pBar.low &&
|
||||
// mcConditions.isSARBullish
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// // Fib3 Crossed Over Verifier ...
|
||||
// pvConditions.fib3s[cIndex] > mcConditions.verifier[cIndex] &&
|
||||
// pvConditions.fib3s[pIndex] <= mcConditions.verifier[pIndex]
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// // Fast Over Slow and Slow Over Verifier ...
|
||||
// mcConditions.fast[cIndex] > mcConditions.slow[cIndex] &&
|
||||
// mcConditions.slow[cIndex] > mcConditions.verifier[cIndex]
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// // CBar and PBar Close over Fast ...
|
||||
// cBar.close > mcConditions.verifier[cIndex] &&
|
||||
// pBar.close > mcConditions.verifier[pIndex]
|
||||
// //
|
||||
// ;
|
||||
|
||||
//
|
||||
// hasLong =
|
||||
// //
|
||||
// isBullishTrend
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// mcConditions.fast[cIndex] > mcConditions.fast[pIndex] &&
|
||||
// mcConditions.slow[cIndex] > mcConditions.slow[pIndex]
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// mcConditions.fast[cIndex] > mcConditions.slow[cIndex] &&
|
||||
// mcConditions.fast[pIndex] < mcConditions.slow[pIndex]
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// mcConditions.fast[cIndex] > mcConditions.verifier[cIndex] &&
|
||||
// mcConditions.fast[pIndex] > mcConditions.verifier[pIndex] &&
|
||||
// mcConditions.slow[cIndex] > mcConditions.verifier[cIndex] &&
|
||||
// mcConditions.slow[pIndex] > mcConditions.verifier[pIndex]
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// cBar.close > mcConditions.fast[cIndex] &&
|
||||
// cBar.close > mcConditions.slow[cIndex] &&
|
||||
// cBar.close > mcConditions.fast[pIndex] &&
|
||||
// cBar.close > mcConditions.slow[pIndex]
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// mcConditions.psar[cIndex] < cBar.low
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// pvConditions.peaks[cIndex] != EMPTY_VALUE &&
|
||||
// pvConditions.peaks[pIndex] != EMPTY_VALUE &&
|
||||
// pvConditions.peaks[cIndex] > pvConditions.peaks[pIndex]
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// pvConditions.fib3s[cIndex] > mcConditions.verifier[cIndex] &&
|
||||
// pvConditions.fib3s[cIndex] >= pvConditions.fib3s[pIndex]
|
||||
// //
|
||||
// ;
|
||||
|
||||
// //
|
||||
// // Check Fib3 Crosses ...
|
||||
// bool isFib3CrossedUnder = IsValid(fibs3CrossedUnderTime);
|
||||
// bool isFib3CrossedOver = IsValid(fibs3CrossedOverTime);
|
||||
|
||||
// //
|
||||
// // Check Fib3 Crossed Under ...
|
||||
// if (!isFib3CrossedUnder)
|
||||
// {
|
||||
// //
|
||||
// isFib3CrossedUnder =
|
||||
// //
|
||||
// cBar.high < pvConditions.fib3s[cIndex] &&
|
||||
// pBar.high > pvConditions.fib3s[pIndex]
|
||||
// //
|
||||
// ;
|
||||
// if (isFib3CrossedUnder)
|
||||
// {
|
||||
// fibs3CrossedUnderTime = cBar.time;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //
|
||||
// // Check Age ...
|
||||
// int age = ((int)((int)cBar.time - (int)fibs3CrossedUnderTime) / PeriodSeconds(mPeriod));
|
||||
// if (age >= 20)
|
||||
// {
|
||||
// fibs3CrossedUnderTime = NULL;
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// // Check Fib3 Crossed Over ...
|
||||
// if (!isFib3CrossedOver)
|
||||
// {
|
||||
// //
|
||||
// isFib3CrossedOver =
|
||||
// //
|
||||
// cBar.low > pvConditions.fib3s[cIndex] &&
|
||||
// pBar.low < pvConditions.fib3s[pIndex]
|
||||
// //
|
||||
// ;
|
||||
// if (isFib3CrossedOver)
|
||||
// {
|
||||
// fibs3CrossedOverTime = cBar.time;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //
|
||||
// // Check Age ...
|
||||
// int age = ((int)((int)cBar.time - (int)fibs3CrossedOverTime) / PeriodSeconds(mPeriod));
|
||||
// if (age >= 20)
|
||||
// {
|
||||
// fibs3CrossedOverTime = NULL;
|
||||
// }
|
||||
// }
|
||||
|
||||
// //
|
||||
// result =
|
||||
// //
|
||||
// isFib3CrossedOver
|
||||
// //
|
||||
// ||
|
||||
// //
|
||||
// isFib3CrossedUnder
|
||||
// //
|
||||
// ;
|
||||
// if (!result)
|
||||
// {
|
||||
// return result;
|
||||
// }
|
||||
|
||||
|
||||
// hasLong =
|
||||
//
|
||||
// // isBullishTrend
|
||||
// // //
|
||||
// // &&
|
||||
// //
|
||||
// hasBullishPattern
|
||||
// //
|
||||
// &&
|
||||
//
|
||||
// cBar.IsBullishTouched(pvConditions.fib3s[cIndex])
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// cBar.close > mcConditions.verifier[cIndex]
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// mcConditions.psar[cIndex] < cBar.low
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// pvConditions.fib3s[cIndex] > mcConditions.verifier[cIndex]
|
||||
// //
|
||||
// &&
|
||||
// //
|
||||
// cBar.IsBullish()
|
||||
//
|
||||
// ;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//
|
||||
// SaherElm IT Center XTest MQL5 Expert Advisor
|
||||
// -------------------------------------------------
|
||||
// Name: XSTestEA
|
||||
// Description: an Exper Advisor which used XTestSetup
|
||||
// to Analyse Market ...
|
||||
//
|
||||
// Maintainer:
|
||||
// ------------
|
||||
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
||||
//
|
||||
//////////////////////////////////////////////////////x
|
||||
//
|
||||
// Global Properties ...
|
||||
#property copyright "Copyright 2023, SaherElm IT Center"
|
||||
#property link "https://saherelm.ir"
|
||||
#property version "1.00"
|
||||
#property description "SaherElm XSTestEA"
|
||||
#property strict
|
||||
|
||||
//
|
||||
#define ShortName "XSTestEA"
|
||||
|
||||
//
|
||||
// Imports ...
|
||||
#include "../Helpers/x-saherelm.xct.helper.mq5"
|
||||
#include "../Helpers/x-saherelm.xcc.helper.mq5"
|
||||
|
||||
//
|
||||
#include "../Strategies/x-saherelm.xtest.strategy.mq5"
|
||||
// #include "../Strategies/x-saherelm.xobvg.strategy.mq5"
|
||||
// #include "../Strategies/x-saherelm.xsrbr.strategy.mq5"
|
||||
// #include "../Strategies/x-saherelm.xpvfmc.strategy.mq5"
|
||||
// #include "../Strategies/x-saherelm.xemrng.strategy.mq5"
|
||||
|
||||
//
|
||||
// Inputs ...
|
||||
long eaMagicNumber = 78692110; // Magic Number
|
||||
int eaSlippage = 10; // Slippgae
|
||||
|
||||
//
|
||||
double eaVolume = 0.01;
|
||||
double eaAllowLong = true;
|
||||
double eaAllowShort = true;
|
||||
|
||||
//
|
||||
int eaMaxAllowedLongs = 0;
|
||||
int eaMaxAllowedShorts = 0;
|
||||
|
||||
//
|
||||
double eaTPPoint = 200;
|
||||
double eaSLPoint = 100;
|
||||
|
||||
//
|
||||
bool eaIgnoreTP = false;
|
||||
bool eaIgnoreSL = false;
|
||||
|
||||
//
|
||||
double eaR2R = 2;
|
||||
|
||||
//
|
||||
// Variables ...
|
||||
XSCXCTHelper *mCTHelper;
|
||||
XSCXCCHelper *mCCHelper;
|
||||
|
||||
//
|
||||
XSCBaseStrategy *strategies[];
|
||||
|
||||
//
|
||||
// Event Handlers ...
|
||||
|
||||
//
|
||||
// Initialization ...
|
||||
int OnInit()
|
||||
{
|
||||
//
|
||||
if (!ValidateInputs())
|
||||
{
|
||||
return INIT_PARAMETERS_INCORRECT;
|
||||
}
|
||||
|
||||
//
|
||||
if (!InitialEA())
|
||||
{
|
||||
return INIT_FAILED;
|
||||
}
|
||||
|
||||
//
|
||||
drawPrefix = ShortName;
|
||||
|
||||
//
|
||||
// EventSetTimer(1);
|
||||
// EventSetMillisecondTimer(100);
|
||||
|
||||
//
|
||||
// Init Succeed ...
|
||||
return INIT_SUCCEEDED;
|
||||
}
|
||||
|
||||
//
|
||||
// DeInitialization ...
|
||||
void OnDeinit(const int reason)
|
||||
{
|
||||
//
|
||||
// REASON_PROGRAM 0 The EA has stopped working calling the ExpertRemove() function
|
||||
// REASON_REMOVE 1 Program removed from a chart
|
||||
// REASON_RECOMPILE 2 Program recompiled
|
||||
// REASON_CHARTCHANGE 3 A symbol or a chart period is changed
|
||||
// REASON_CHARTCLOSE 4 Chart closed
|
||||
// REASON_PARAMETERS 5 Inputs changed by a user
|
||||
// REASON_ACCOUNT 6 Another account has been activated or reconnection to the trade server has occurred due to changes in the account settings
|
||||
// REASON_TEMPLATE 7 Another chart template applied
|
||||
// REASON_INITFAILED 8 The OnInit() handler returned a non-zero value
|
||||
// REASON_CLOSE 9 Terminal closed
|
||||
|
||||
//
|
||||
// De Initialize XSampleEA Providers ...
|
||||
delete mCTHelper;
|
||||
delete mCCHelper;
|
||||
|
||||
//
|
||||
// EventKillTimer();
|
||||
|
||||
//
|
||||
Clean(strategies);
|
||||
}
|
||||
|
||||
//
|
||||
// On Tick Handler ...
|
||||
void OnTick()
|
||||
{
|
||||
HandleStrategiesOnTick();
|
||||
}
|
||||
|
||||
//
|
||||
// On Timer ...
|
||||
void OnTimer()
|
||||
{
|
||||
//
|
||||
// HandleStrategiesOnTick();
|
||||
}
|
||||
|
||||
//
|
||||
// Custom Functions ...
|
||||
|
||||
//
|
||||
// Validate Inputs ...
|
||||
bool ValidateInputs()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
result = true;
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize all Requirements ...
|
||||
bool InitialEA()
|
||||
{
|
||||
//
|
||||
bool result = false;
|
||||
|
||||
//
|
||||
// Bar Timer ...
|
||||
XCTInputs ctInputs;
|
||||
ctInputs.Default();
|
||||
mCTHelper = new XSCXCTHelper();
|
||||
result = mCTHelper.Init(
|
||||
_Symbol,
|
||||
_Period,
|
||||
ctInputs //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Bar Styles ...
|
||||
XCCInputs ccInputs;
|
||||
ccInputs.Default();
|
||||
mCCHelper = new XSCXCCHelper();
|
||||
result = mCCHelper.Init(
|
||||
_Symbol,
|
||||
_Period,
|
||||
ccInputs //
|
||||
);
|
||||
if (!result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
XSymbolParser symbolParser;
|
||||
|
||||
//
|
||||
bool drawAreas = false;
|
||||
|
||||
//
|
||||
bool useEURUSD = true;
|
||||
bool useUSDCHF = false;
|
||||
bool useUSDJPY = false;
|
||||
bool useGBPUSD = false;
|
||||
bool useXAUUSD = false;
|
||||
|
||||
//
|
||||
bool useXSRBR = false;
|
||||
bool useXEMRNG = false;
|
||||
bool useXOBVG = false;
|
||||
bool useXPVFMC = false;
|
||||
bool useXTest = true;
|
||||
|
||||
//
|
||||
// EURUSD ...
|
||||
string eurusdSymbol = "EURUSDb"; // symbolParser.GetEURUSDSymbol();
|
||||
if (useEURUSD && IsValid(eurusdSymbol))
|
||||
{
|
||||
//
|
||||
// MAGIC NUMBER ...
|
||||
long magicNumber = eaMagicNumber + 1;
|
||||
|
||||
//
|
||||
// XTest ...
|
||||
if (useXTest)
|
||||
{
|
||||
//
|
||||
XSCXTestStrategy *eurusdTestStrategy;
|
||||
eurusdTestStrategy = new XSCXTestStrategy(
|
||||
eurusdSymbol,
|
||||
PERIOD_M5,
|
||||
eaVolume,
|
||||
eaR2R, // R2R ...
|
||||
eaSlippage,
|
||||
magicNumber,
|
||||
false, // Use TP SL Point
|
||||
false, // Use Max
|
||||
eaTPPoint, // TP
|
||||
eaSLPoint, // SL
|
||||
eaIgnoreTP,
|
||||
eaIgnoreSL,
|
||||
eaAllowLong,
|
||||
eaAllowShort,
|
||||
eaMaxAllowedLongs, // Max Longs
|
||||
eaMaxAllowedShorts // Max Shorts
|
||||
);
|
||||
eurusdTestStrategy.SetAlertLogAlerts(true);
|
||||
eurusdTestStrategy.SetAlertEnableAlerts(true);
|
||||
RegisterStrategy(eurusdTestStrategy);
|
||||
}
|
||||
|
||||
// //
|
||||
// // XSRBR ...
|
||||
// if (useXSRBR)
|
||||
// {
|
||||
// //
|
||||
// // 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(
|
||||
// eurusdSymbol,
|
||||
// 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
|
||||
// );
|
||||
// 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);
|
||||
// }
|
||||
|
||||
// //
|
||||
// // XPVFMC ...
|
||||
// if (useXPVFMC)
|
||||
// {
|
||||
// //
|
||||
// XSCXPVFMCStrategy *eurusdM5PVFMCStrategy;
|
||||
// eurusdM5PVFMCStrategy = new XSCXPVFMCStrategy(
|
||||
// eurusdSymbol,
|
||||
// PERIOD_M5,
|
||||
// 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
|
||||
// );
|
||||
// eurusdM5PVFMCStrategy.SetAlertLogAlerts(true);
|
||||
// eurusdM5PVFMCStrategy.SetAlertEnableAlerts(true);
|
||||
// RegisterStrategy(eurusdM5PVFMCStrategy);
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
// 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);
|
||||
// }
|
||||
}
|
||||
|
||||
//
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// Register Strategy ...
|
||||
void RegisterStrategy(XSCBaseStrategy *strategy)
|
||||
{
|
||||
//
|
||||
if (strategy == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
ArrayResize(
|
||||
strategies,
|
||||
ArraySize(strategies) + 1 //
|
||||
);
|
||||
|
||||
//
|
||||
strategies[ArraySize(strategies) - 1] = strategy;
|
||||
}
|
||||
|
||||
//
|
||||
// Call All Registered Strategis Tick Handler Functions ...
|
||||
void HandleStrategiesOnTick()
|
||||
{
|
||||
//
|
||||
int count = ArraySize(strategies);
|
||||
if (!IsValidSize(count))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
//
|
||||
// Call Tick Handler Function ...
|
||||
strategies[i].HandleTick();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Custom Testing Functions ...
|
||||
|
||||
//
|
||||
Reference in New Issue
Block a user