/////////////////////////////////////////////////////// // // SaherElm IT Center MQL5 Strategy Parser Library // ------------------------------------------------ // Name: XCHStartegyConditionsParser // Description: provide all conditions parsing // for XCH Strategy ... // // // 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 "../../Strategies/x-saherelm.xch.strategy.mq5" // #include "./DowJones/x-saherelm.xch.amarkets.us30.long.parser.mq5" #include "./DowJones/x-saherelm.xch.amarkets.us30.short.parser.mq5" #include "./EURGBP/x-saherelm.xch.amarkets.eurgbp.long.parser.mq5" #include "./EURGBP/x-saherelm.xch.amarkets.eurgbp.short.parser.mq5" #include "./EURJPY/x-saherelm.xch.amarkets.eurjpy.long.parser.mq5" #include "./EURJPY/x-saherelm.xch.amarkets.eurjpy.short.parser.mq5" #include "./EURCHF/x-saherelm.xch.amarkets.eurchf.long.parser.mq5" #include "./EURCHF/x-saherelm.xch.amarkets.eurchf.short.parser.mq5" #include "./AUDUSD/x-saherelm.xch.amarkets.audusd.long.parser.mq5" #include "./AUDUSD/x-saherelm.xch.amarkets.audusd.short.parser.mq5" #include "./NZDUSD/x-saherelm.xch.amarkets.nzdusd.long.parser.mq5" #include "./NZDUSD/x-saherelm.xch.amarkets.nzdusd.short.parser.mq5" #include "./USDCAD/x-saherelm.xch.amarkets.usdcad.long.parser.mq5" #include "./USDCAD/x-saherelm.xch.amarkets.usdcad.short.parser.mq5" #include "./EURCAD/x-saherelm.xch.amarkets.eurcad.long.parser.mq5" #include "./EURCAD/x-saherelm.xch.amarkets.eurcad.short.parser.mq5" #include "./EURUSD/x-saherelm.xch.amarkets.eurusd.long.parser.mq5" #include "./EURUSD/x-saherelm.xch.amarkets.eurusd.short.parser.mq5" #include "./USDJPY/x-saherelm.xch.amarkets.usdjpy.long.parser.mq5" #include "./USDJPY/x-saherelm.xch.amarkets.usdjpy.short.parser.mq5" #include "./USDCHF/x-saherelm.xch.amarkets.usdchf.long.parser.mq5" #include "./USDCHF/x-saherelm.xch.amarkets.usdchf.short.parser.mq5" #include "./GBPUSD/x-saherelm.xch.amarkets.gbpusd.long.parser.mq5" #include "./GBPUSD/x-saherelm.xch.amarkets.gbpusd.short.parser.mq5" #include "./XAUUSD/x-saherelm.xch.amarkets.xauusd.long.parser.mq5" #include "./XAUUSD/x-saherelm.xch.amarkets.xauusd.short.parser.mq5" // // Conditions Parser ... struct XCHStartegyAMarketsConditionsParser { // string _version; // // Parsers ... XSymbolParser _symbolParser; // // EURUSD ... XCHStartegyAMarketsEURUSDLongConditionsParser _eurusdLongParser; XCHStartegyAMarketsEURUSDShortConditionsParser _eurusdShortParser; // // GBPUSD ... XCHStartegyAMarketsGBPUSDLongConditionsParser _gbpusdLongParser; XCHStartegyAMarketsGBPUSDShortConditionsParser _gbpusdShortParser; // // EURGBP ... XCHStartegyAMarketsEURGBPLongConditionsParser _eurgbpLongParser; XCHStartegyAMarketsEURGBPShortConditionsParser _eurgbpShortParser; // // USDJPY ... XCHStartegyAMarketsUSDJPYLongConditionsParser _usdjpyLongParser; XCHStartegyAMarketsUSDJPYShortConditionsParser _usdjpyShortParser; // // EURJPY ... XCHStartegyAMarketsEURJPYLongConditionsParser _eurjpyLongParser; XCHStartegyAMarketsEURJPYShortConditionsParser _eurjpyShortParser; // // USDCHF ... XCHStartegyAMarketsUSDCHFLongConditionsParser _usdchfLongParser; XCHStartegyAMarketsUSDCHFShortConditionsParser _usdchfShortParser; // // EURCHF ... XCHStartegyAMarketsEURCHFLongConditionsParser _eurchfLongParser; XCHStartegyAMarketsEURCHFShortConditionsParser _eurchfShortParser; // // XAUUSD ... XCHStartegyAMarketsXAUUSDLongConditionsParser _xauusdLongParser; XCHStartegyAMarketsXAUUSDShortConditionsParser _xauusdShortParser; // // DOWJONES ... XCHStartegyAMarketsUS30LongConditionsParser _dowjonesLongParser; XCHStartegyAMarketsUS30ShortConditionsParser _dowjonesShortParser; // // AUDUSD ... XCHStartegyAMarketsAUDUSDLongConditionsParser _audusdLongParser; XCHStartegyAMarketsAUDUSDShortConditionsParser _audusdShortParser; // // NZDUSD ... XCHStartegyAMarketsNZDUSDLongConditionsParser _nzdusdLongParser; XCHStartegyAMarketsNZDUSDShortConditionsParser _nzdusdShortParser; // // USDCAD ... XCHStartegyAMarketsUSDCADLongConditionsParser _usdcadLongParser; XCHStartegyAMarketsUSDCADShortConditionsParser _usdcadShortParser; // // EURCAD ... XCHStartegyAMarketsEURCADLongConditionsParser _eurcadLongParser; XCHStartegyAMarketsEURCADShortConditionsParser _eurcadShortParser; // bool IsFiltered( XSignal &signal, // Provided Signal XCHStrategyConditions &conditions, // Market Conditions bool force = false // ) { // bool result = false; // // Validate Args ... if (!signal.IsValid() || !conditions.IsValid()) { // result = true; return result; } // bool isLong = IsLong(signal.type); // result = // isLong ? IsLongFiltered( signal, conditions, force // ) : IsShortFiltered( signal, conditions, force // ) // ; // return result; } // // Filter Long Signals ... bool IsLongFiltered( XSignal &signal, XCHStrategyConditions &conditions, bool force = false // ) { // bool result = false; // bool isEURUSD = _symbolParser.IsEURUSD(signal.symbol); bool isGBPUSD = _symbolParser.IsGBPUSD(signal.symbol); bool isEURGBP = _symbolParser.IsEURGBP(signal.symbol); bool isXAUUSD = _symbolParser.IsXAUUSD(signal.symbol); bool isUSDJPY = _symbolParser.IsUSDJPY(signal.symbol); bool isEURJPY = _symbolParser.IsEURJPY(signal.symbol); bool isUSDCHF = _symbolParser.IsUSDCHF(signal.symbol); bool isEURCHF = _symbolParser.IsEURCHF(signal.symbol); bool isAUDUSD = _symbolParser.IsAUDUSD(signal.symbol); bool isNZDUSD = _symbolParser.IsNZDUSD(signal.symbol); bool isUSDCAD = _symbolParser.IsUSDCAD(signal.symbol); bool isEURCAD = _symbolParser.IsEURCAD(signal.symbol); bool isDowJones = _symbolParser.IsDowJones(signal.symbol); // if (!force) { // if (isEURUSD) { // result = _eurusdLongParser.IsFiltered(conditions); } else if (isGBPUSD) { // result = _gbpusdLongParser.IsFiltered(conditions); } else if (isEURGBP) { // result = _eurgbpLongParser.IsFiltered(conditions); } else if (isUSDJPY) { // result = _usdjpyLongParser.IsFiltered(conditions); } else if (isEURJPY) { // result = _eurjpyLongParser.IsFiltered(conditions); } else if (isUSDCHF) { // result = _usdchfLongParser.IsFiltered(conditions); } else if (isEURCHF) { // result = _eurchfLongParser.IsFiltered(conditions); } else if (isXAUUSD) { // result = _xauusdLongParser.IsFiltered(conditions); } else if (isAUDUSD) { // result = _audusdLongParser.IsFiltered(conditions); } else if (isNZDUSD) { // result = _nzdusdLongParser.IsFiltered(conditions); } else if (isUSDCAD) { // result = _usdcadLongParser.IsFiltered(conditions); } else if (isEURCAD) { // result = _eurcadLongParser.IsFiltered(conditions); } else if (isDowJones) { // result = _dowjonesLongParser.IsFiltered(conditions); } } else { // result = // _eurusdLongParser.IsFiltered(conditions) // || // _gbpusdLongParser.IsFiltered(conditions) // || // _eurgbpLongParser.IsFiltered(conditions) // || // _usdjpyLongParser.IsFiltered(conditions) // || // _eurjpyLongParser.IsFiltered(conditions) // || // _usdchfLongParser.IsFiltered(conditions) // || // _eurchfLongParser.IsFiltered(conditions) // || // _xauusdLongParser.IsFiltered(conditions) // || // _audusdLongParser.IsFiltered(conditions) // || // _nzdusdLongParser.IsFiltered(conditions) // || // _usdcadLongParser.IsFiltered(conditions) // || // _eurcadLongParser.IsFiltered(conditions) // || // _dowjonesLongParser.IsFiltered(conditions) // ; } // return result; } // // Filter Short Signals ... bool IsShortFiltered( XSignal &signal, XCHStrategyConditions &conditions, bool force = false // ) { // bool result = false; // bool isEURUSD = _symbolParser.IsEURUSD(signal.symbol); bool isGBPUSD = _symbolParser.IsGBPUSD(signal.symbol); bool isEURGBP = _symbolParser.IsEURGBP(signal.symbol); bool isXAUUSD = _symbolParser.IsXAUUSD(signal.symbol); bool isUSDJPY = _symbolParser.IsUSDJPY(signal.symbol); bool isEURJPY = _symbolParser.IsEURJPY(signal.symbol); bool isUSDCHF = _symbolParser.IsUSDCHF(signal.symbol); bool isEURCHF = _symbolParser.IsEURCHF(signal.symbol); bool isAUDUSD = _symbolParser.IsAUDUSD(signal.symbol); bool isNZDUSD = _symbolParser.IsNZDUSD(signal.symbol); bool isUSDCAD = _symbolParser.IsUSDCAD(signal.symbol); bool isEURCAD = _symbolParser.IsEURCAD(signal.symbol); bool isDowJones = _symbolParser.IsDowJones(signal.symbol); // if (!force) { // if (isEURUSD) { // result = _eurusdShortParser.IsFiltered(conditions); } else if (isGBPUSD) { // result = _gbpusdShortParser.IsFiltered(conditions); } else if (isEURGBP) { // result = _eurgbpShortParser.IsFiltered(conditions); } else if (isUSDJPY) { // result = _usdjpyShortParser.IsFiltered(conditions); } else if (isEURJPY) { // result = _eurjpyShortParser.IsFiltered(conditions); } else if (isUSDCHF) { // result = _usdchfShortParser.IsFiltered(conditions); } else if (isEURCHF) { // result = _eurchfShortParser.IsFiltered(conditions); } else if (isXAUUSD) { // result = _xauusdShortParser.IsFiltered(conditions); } else if (isAUDUSD) { // result = _audusdShortParser.IsFiltered(conditions); } else if (isNZDUSD) { // result = _nzdusdShortParser.IsFiltered(conditions); } else if (isUSDCAD) { // result = _usdcadShortParser.IsFiltered(conditions); } else if (isEURCAD) { // result = _eurcadShortParser.IsFiltered(conditions); } else if (isDowJones) { // result = _dowjonesShortParser.IsFiltered(conditions); } } else { // result = // _eurusdShortParser.IsFiltered(conditions) // || // _gbpusdShortParser.IsFiltered(conditions) // || // _eurgbpShortParser.IsFiltered(conditions) // || // _usdjpyShortParser.IsFiltered(conditions) // || // _eurjpyShortParser.IsFiltered(conditions) // || // _usdchfShortParser.IsFiltered(conditions) // || // _eurchfShortParser.IsFiltered(conditions) // || // _xauusdShortParser.IsFiltered(conditions) // || // _audusdShortParser.IsFiltered(conditions) // || // _nzdusdShortParser.IsFiltered(conditions) // || // _usdcadShortParser.IsFiltered(conditions) // || // _eurcadShortParser.IsFiltered(conditions) // || // _dowjonesShortParser.IsFiltered(conditions) // ; } // return result; } }; //