From a069c2dd59f7e21004b965ec73ff5e0db921fc01 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Fri, 23 Aug 2024 02:10:02 +0330 Subject: [PATCH] last ... --- Classes/x-saherelm.xtrade.class.mq5 | 33 +++++++++++++++++++ Experts/x-saherelm.xch.strategy.ea.mq5 | 12 ++++--- Libraries/x-saherelm.common.lib.mq5 | 31 +++++++++++++++-- MQL5.code-workspace | 7 +++- Parsers/AMarkets/.gitkeep | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 ...saherelm.xch.market.symbol.long.parser.mq5 | 0 ...aherelm.xch.market.symbol.short.parser.mq5 | 0 Parsers/Alpari/.gitkeep | 0 Parsers/Errante/.gitkeep | 0 Parsers/IFCMarkets/.gitkeep | 0 Parsers/Ingot/.gitkeep | 0 Parsers/OtetMarkets/.gitkeep | 0 Parsers/x-saherelm.xch.parser.mq5 | 10 ++++++ Strategies/x-saherelm.xch.strategy.mq5 | 17 ---------- 38 files changed, 84 insertions(+), 26 deletions(-) create mode 100644 Parsers/AMarkets/.gitkeep create mode 100644 Parsers/AMarkets/AUDUSD/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/AUDUSD/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/DowJones/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/DowJones/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/EURCAD/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/EURCAD/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/EURCHF/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/EURCHF/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/EURGBP/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/EURGBP/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/EURJPY/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/EURJPY/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/EURUSD/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/EURUSD/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/GBPUSD/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/GBPUSD/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/NZDUSD/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/NZDUSD/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/USDCAD/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/USDCAD/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/USDCHF/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/USDCHF/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/USDJPY/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/USDJPY/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/AMarkets/XAUUSD/x-saherelm.xch.market.symbol.long.parser.mq5 create mode 100644 Parsers/AMarkets/XAUUSD/x-saherelm.xch.market.symbol.short.parser.mq5 create mode 100644 Parsers/Alpari/.gitkeep create mode 100644 Parsers/Errante/.gitkeep create mode 100644 Parsers/IFCMarkets/.gitkeep create mode 100644 Parsers/Ingot/.gitkeep create mode 100644 Parsers/OtetMarkets/.gitkeep diff --git a/Classes/x-saherelm.xtrade.class.mq5 b/Classes/x-saherelm.xtrade.class.mq5 index 0021f658..f1bf80e2 100644 --- a/Classes/x-saherelm.xtrade.class.mq5 +++ b/Classes/x-saherelm.xtrade.class.mq5 @@ -5017,6 +5017,39 @@ public: } } + // + void RemoveSignal(XSignal &signal) + { + // + if (!signal.IsValid()) + { + return; + } + + // + int signalIDX = -1; + ENUM_X_POSITION_TYPES xType = ToPositionType(signal.type); + bool hasSignal = HasItem( + signal.symbol, + signal.provider, + signal.period, + xType, + signalIDX // + ); + if (!hasSignal || !IsValidIndex(signalIDX)) + { + return; + } + + // + // Remove Item From List ... + ArrayRemove( + mData, + signalIDX, + 1 // + ); + } + // // Do all Protections ... void HandleProtection() diff --git a/Experts/x-saherelm.xch.strategy.ea.mq5 b/Experts/x-saherelm.xch.strategy.ea.mq5 index 48350d83..e0170dfa 100644 --- a/Experts/x-saherelm.xch.strategy.ea.mq5 +++ b/Experts/x-saherelm.xch.strategy.ea.mq5 @@ -636,11 +636,11 @@ bool InitialEA() eaR2R, // R2R ... eaSlippage, eaMagicNumber, - true, // Ignore Signal Execution - true, // Use TP SL Point - false, // Use Max - eaTPPoint, // TP - eaSLPoint, // SL + true, // Ignore Signal Execution + eaUseFixedTPSLPoints, // Use TP SL Point + false, // Use Max + eaTPPoint, // TP + eaSLPoint, // SL eaIgnoreTP, eaIgnoreSL, eaAllowLong, @@ -856,6 +856,8 @@ void OnSignalRecieved( ); if (isFiltered) { + // + eaTradeHandler.RemoveSignal(signal); return; } diff --git a/Libraries/x-saherelm.common.lib.mq5 b/Libraries/x-saherelm.common.lib.mq5 index a0deff44..6f12f3a6 100644 --- a/Libraries/x-saherelm.common.lib.mq5 +++ b/Libraries/x-saherelm.common.lib.mq5 @@ -5236,10 +5236,10 @@ struct XSymbolParser string version; // Temp ... // - // Forext ... + // Symbol Parsing ... // - // Symbol Parsing ... + // Forext ... // bool IsEURUSD(string symbol) @@ -5529,6 +5529,9 @@ struct XSymbolParser return result; } + // + // Indexes ... + // bool IsDowJones(string symbol) { @@ -5609,7 +5612,7 @@ struct XSymbolSessionParser } // - ENUM_DAY_OF_WEEK dayOfWeek = (ENUM_DAY_OF_WEEK) timeStruct.day_of_week; + ENUM_DAY_OF_WEEK dayOfWeek = (ENUM_DAY_OF_WEEK)timeStruct.day_of_week; // datetime cTime = TimeCurrent(); @@ -5637,6 +5640,28 @@ struct XSymbolSessionParser } }; +// +// Parsing Market Names ... +struct XMarketParser +{ + // + string _version; // Temp ... + + // + bool IsAMarkets(string market) + { + // + bool result = false; + + // + result = IsValid(market) && + market == "AMarkets LLC"; + + // + return result; + } +}; + // // Styling Buffers ... diff --git a/MQL5.code-workspace b/MQL5.code-workspace index 57097327..8a663c03 100644 --- a/MQL5.code-workspace +++ b/MQL5.code-workspace @@ -4,5 +4,10 @@ "path": "." } ], - "settings": {} + "settings": { + "C_Cpp.default.includePath": [ + "c:\\Users\\SaherElm\\AppData\\Roaming\\MetaQuotes\\Terminal\\D0E8209F77C8CF37AD8BF550E51FF075\\MQL5\\Include\\Include", + "c:\\Users\\SaherElm\\AppData\\Roaming\\MetaQuotes\\Terminal\\D0E8209F77C8CF37AD8BF550E51FF075\\MQL5\\Include" + ] + } } diff --git a/Parsers/AMarkets/.gitkeep b/Parsers/AMarkets/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/AUDUSD/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/AUDUSD/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/AUDUSD/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/AUDUSD/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/DowJones/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/DowJones/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/DowJones/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/DowJones/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/EURCAD/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/EURCAD/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/EURCAD/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/EURCAD/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/EURCHF/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/EURCHF/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/EURCHF/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/EURCHF/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/EURGBP/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/EURGBP/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/EURGBP/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/EURGBP/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/EURJPY/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/EURJPY/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/EURJPY/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/EURJPY/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/EURUSD/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/EURUSD/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/EURUSD/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/EURUSD/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/GBPUSD/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/GBPUSD/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/GBPUSD/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/GBPUSD/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/NZDUSD/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/NZDUSD/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/NZDUSD/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/NZDUSD/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/USDCAD/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/USDCAD/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/USDCAD/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/USDCAD/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/USDCHF/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/USDCHF/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/USDCHF/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/USDCHF/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/USDJPY/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/USDJPY/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/USDJPY/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/USDJPY/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/XAUUSD/x-saherelm.xch.market.symbol.long.parser.mq5 b/Parsers/AMarkets/XAUUSD/x-saherelm.xch.market.symbol.long.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/AMarkets/XAUUSD/x-saherelm.xch.market.symbol.short.parser.mq5 b/Parsers/AMarkets/XAUUSD/x-saherelm.xch.market.symbol.short.parser.mq5 new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/Alpari/.gitkeep b/Parsers/Alpari/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/Errante/.gitkeep b/Parsers/Errante/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/IFCMarkets/.gitkeep b/Parsers/IFCMarkets/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/Ingot/.gitkeep b/Parsers/Ingot/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/OtetMarkets/.gitkeep b/Parsers/OtetMarkets/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/Parsers/x-saherelm.xch.parser.mq5 b/Parsers/x-saherelm.xch.parser.mq5 index 6cd75b44..2c40d59a 100644 --- a/Parsers/x-saherelm.xch.parser.mq5 +++ b/Parsers/x-saherelm.xch.parser.mq5 @@ -63,7 +63,9 @@ struct XCHStartegyConditionsParser // Parsers ... // + XSCAccount _account; XSymbolParser _symbolParser; + XMarketParser _marketParser; // // EURUSD ... @@ -905,6 +907,10 @@ struct XCHStartegyConditionsParser bool isEURCAD = _symbolParser.IsEURCAD(signal.symbol); bool isDowJones = _symbolParser.IsDowJones(signal.symbol); + // + string market = _account.GetCompany(); + bool isAMarkets = _marketParser.IsAMarkets(market); + // if (!force) { @@ -1076,6 +1082,10 @@ struct XCHStartegyConditionsParser bool isEURCAD = _symbolParser.IsEURCAD(signal.symbol); bool isDowJones = _symbolParser.IsDowJones(signal.symbol); + // + string market = _account.GetCompany(); + bool isAMarkets = _marketParser.IsAMarkets(market); + // if (!force) { diff --git a/Strategies/x-saherelm.xch.strategy.mq5 b/Strategies/x-saherelm.xch.strategy.mq5 index 26b58561..a55bd179 100644 --- a/Strategies/x-saherelm.xch.strategy.mq5 +++ b/Strategies/x-saherelm.xch.strategy.mq5 @@ -1260,23 +1260,6 @@ public: return result; } - // // - // result = - // // - // (hasLong && - // bullishTrend.IsValid()) - // // - // || - // // - // (!hasLong && - // bearishTrend.IsValid()) - // // - // ; - // if (!result) - // { - // return result; - // } - // DestroyImportantAreas();