From c6fc9372231677c8e325c85b0e109ec958c992f4 Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Thu, 4 Dec 2025 10:41:06 +0100 Subject: [PATCH] new files added --- Scripts/MyScripts/List_Open_Charts.mq5 | 71 ++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Scripts/MyScripts/List_Open_Charts.mq5 diff --git a/Scripts/MyScripts/List_Open_Charts.mq5 b/Scripts/MyScripts/List_Open_Charts.mq5 new file mode 100644 index 0000000..21fc829 --- /dev/null +++ b/Scripts/MyScripts/List_Open_Charts.mq5 @@ -0,0 +1,71 @@ +//+------------------------------------------------------------------+ +//| List_Open_Charts.mq5 | +//| Copyright 2025, xxxxxxxx| +//+------------------------------------------------------------------+ +#property copyright "Copyright 2025, xxxxxxxx" +#property version "1.00" +#property description "Lists all open chart symbols to the Experts log." +#property description "Generates a comma-separated list for easy copying." +#property script_show_inputs + +//+------------------------------------------------------------------+ +//| Script program start function | +//+------------------------------------------------------------------+ +void OnStart() + { + string symbol_list = ""; + int count = 0; + + long curr_chart = ChartFirst(); + +// Use a dictionary/array to store unique symbols to avoid duplicates in the list +// Since MQL5 doesn't have a built-in Set, we'll just append and maybe check string find, +// or just list all. Let's list unique symbols for the copy-paste string. + + string unique_symbols[]; + + while(curr_chart != -1) + { + string symbol = ChartSymbol(curr_chart); + ENUM_TIMEFRAMES period = ChartPeriod(curr_chart); + + PrintFormat("Chart ID: %I64d | Symbol: %s | Period: %s", curr_chart, symbol, EnumToString(period)); + + // Add to unique list + bool found = false; + for(int i=0; i 0) + symbol_list += ","; + symbol_list += unique_symbols[i]; + } + + Print("--------------------------------------------------"); + PrintFormat("Total Open Charts: %d", count); + Print("Unique Symbols List (Copy for Loader/Closer):"); + Print(symbol_list); + Print("--------------------------------------------------"); + } +//+------------------------------------------------------------------+ +//+------------------------------------------------------------------+