-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChartList1.mq5
38 lines (35 loc) · 1.42 KB
/
ChartList1.mq5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//+------------------------------------------------------------------+
//| ChartList1.mq5 |
//| Copyright 2021, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
ChartList();
}
//+------------------------------------------------------------------+
//| Main worker function to enumerate charts |
//+------------------------------------------------------------------+
void ChartList()
{
const long me = ChartID();
long id = ChartFirst();
// long id = ChartNext(0); - this is the same as ChartFirst()
int count = 0;
Print("Chart List\nN, ID, *active");
// keep enumerating all charts until no more found
while(id != -1)
{
const string header = StringFormat("%d %lld %s",
count, id, (id == me ? "*" : ""));
// columns: N, id, self-mark
Print(header);
count++;
id = ChartNext(id);
}
Print("Total chart number: ", count);
}
//+------------------------------------------------------------------+