From 0fca3aec1e990459e46331e820f6a1f377db5517 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Fri, 9 May 2025 18:33:36 +0330 Subject: [PATCH] add supports for Multi Symbol Multi Sessions Structure ... --- .vscode/vscode-kanban.json | 36 +++++------ Experts/x-saherelm.xcaea.ea.mq5 | 103 ++++++++++++++++++++++---------- 2 files changed, 89 insertions(+), 50 deletions(-) diff --git a/.vscode/vscode-kanban.json b/.vscode/vscode-kanban.json index d92e381a..b64783f6 100644 --- a/.vscode/vscode-kanban.json +++ b/.vscode/vscode-kanban.json @@ -11,15 +11,6 @@ } ], "in-progress": [ - { - "assignedTo": { - "name": "Hadi Khazaee Asl" - }, - "creation_time": "2025-05-09T02:09:15.086Z", - "id": "8", - "references": [], - "title": "add support for Multi Time Frame and Multi Symbol" - }, { "assignedTo": { "name": "Hadi Khazaee Asl" @@ -28,15 +19,6 @@ "id": "4", "references": [], "title": "add support for OB in XCAEA POI Detector" - }, - { - "assignedTo": { - "name": "Hadi Khazaee Asl" - }, - "creation_time": "2025-05-09T02:16:34.743Z", - "id": "9", - "references": [], - "title": "add support for Closing All Trades at Specified Time ..." } ], "testing": [ @@ -68,6 +50,15 @@ "references": [], "title": "add support for Block Detection in Bar Analyser Class" }, + { + "assignedTo": { + "name": "Hadi Khazaee Asl" + }, + "creation_time": "2025-05-09T02:16:34.743Z", + "id": "9", + "references": [], + "title": "add support for Closing All Trades at Specified Time ..." + }, { "assignedTo": { "name": "Hadi Khazaee Asl" @@ -99,6 +90,15 @@ "id": "6", "references": [], "title": "Complete Perday Trade Management based on SL(s) and TP(s)" + }, + { + "assignedTo": { + "name": "Hadi Khazaee Asl" + }, + "creation_time": "2025-05-09T02:09:15.086Z", + "id": "8", + "references": [], + "title": "add support for Multi Time Frame and Multi Symbol" } ], "done": [] diff --git a/Experts/x-saherelm.xcaea.ea.mq5 b/Experts/x-saherelm.xcaea.ea.mq5 index 2908db30..97eda49d 100644 --- a/Experts/x-saherelm.xcaea.ea.mq5 +++ b/Experts/x-saherelm.xcaea.ea.mq5 @@ -44,21 +44,23 @@ input ENUM_TIMEFRAMES eaAnalysisPeriod = PERIOD_H1; // Analysis Period // Symbols ... // // ------------------------------------------------------- +// ---------- // eaSymbols: // ---------- // - if EMPTY use Current Symbol; // - for Multi Symbol use Comma Separated Symbols: // EURUSDb,XAUUSDb // +// ------------------ // eaSymbolSessions: // ------------------ // - if EMPTY use WHOLE Times; // - for each Symbol use Comma Separated: -// (Name,[hh:mm],[hh:mm]), +// (XEURS1_02:00_14:00),(XEURS2_19:00_23:00)| // ------------------------------------------------------- input group "Symbols"; -input string eaSymbols = "EURUSDb,XAUUSDb"; // Symbols Description -input string eaSymbolSessions = "()"; // Symbols Sessions +input string eaSymbols = "EURUSDb,XAUUSDb"; // Symbols Description +input string eaSymbolSessions = "(XEURS1_02:00_14:00),(XEURS2_19:00_23:00)|(XAUSDS1_02:00_21:00)"; // Symbols Sessions // // Volume ... @@ -763,14 +765,17 @@ void InitSymbolSessions() if (hasSession) { // + // Extract Per Symbol Sessions ... sessionsCount = SplitContent( sessions, - eaSymbolSessions // + eaSymbolSessions, + "|" // ); } // // Setting Up Symbols ... + bool has = false; // for (int i = 0; i < symbolsCount; i++) @@ -801,45 +806,79 @@ void InitSymbolSessions() if (hasSession) { // - for (int i = 0; i < symbolsCount; i++) { + for (int i = 0; i < symbolsCount; i++) + { // iSymbol = symbols[i]; // - if (i < sessionsCount) { + if (i < sessionsCount) + { // - // Parsing Session Info ... - string tmp[]; - string iSession = sessions[i]; - iSession - // int tmpCount = SplitContent( - // tmp, - // sessions[i] // - // ); + // Extract Per Symbol Sessions ... + string iSymbolSessionsStr[]; + int iSymbolSessionsCount = SplitContent( + iSymbolSessionsStr, + sessions[i], + "," // + ); // - // string iName = ; + has = IsValidSize(iSymbolSessionsCount); + if (has) + { + // + // Loop through Symbols Sessions ... + for (int j = 0; j < iSymbolSessionsCount; j++) + { + // + string iSessionDescriptorStr = ExtractString(iSymbolSessionsStr[j]); + has = IsValid(iSessionDescriptorStr); + if (has) + { + // + // Extract Session Descriptor Data ... + string parts[]; + int partsCount = SplitContent( + parts, + iSessionDescriptorStr, + "_" // + ); + has = IsValidSize(partsCount) && partsCount == 3; + if (has) + { + // + string iName = parts[0]; + string iStart = parts[1]; + string iEnd = parts[2]; + has = IsValid(iName) && + IsValid(iStart) && + IsValid(iEnd); + if (has) + { + // + eaTradeManager + .SetTradeSession( + iSymbol, + iStart, + iEnd, + iName // + ); + } + } + + // + Clean(parts); + } + } + } + + // + Clean(iSymbolSessionsStr); } } } - // - // Setting Sessions ... - // eaTradeManager - // .SetTradeSession( - // _Symbol, - // "01:30", // Start ... - // "14:25", // End ... - // "XSaherSession" // Name ... - // ); - // eaTradeManager - // .SetTradeSession( - // _Symbol, - // "19:30", // Start ... - // "11:30", // End ... - // "XSaherSession" // Name ... - // ); - // Clean(symbols); Clean(sessions);