Download MetaTrader 5
To add comments, please log in or register
Find and download Code Base apps via MetaTrader. It is fast!
Carl Schreiber
5966
Carl Schreiber 2014.03.19 15:16 

Hi I just started in debug mode in a script just this:

long    Ch01 = ChartFirst(),
        ChMe = ChartID();
long    ChNx = ChartNext(ChMe);

and get:

Ch01:130395223288765087 long
ChMe:130370193351027474 long
ChNx:-1 long

I expect s.th. like 0, 3, -1 it is the last Chart?? What is meant with ID of ChartFirst() by this huge numbers much bigger than CHARTS_MAX = 100?

Can I (my EA) find out on which chart it is running with the idea that the first chart should have either 0 or 1 and the next chart just 1 more.

Gooly

PS: I I run this script

void OnStart()  {
long    Ch01 = ChartFirst(),
        ChMe = ChartID();
long    ChNx = ChartNext(ChMe);
Print("First: ",Ch01,"  Me: ",ChMe,"  Next: ",ChNx);
}

directly on the first chart with no other chart I get ( ChNx != -1 ??)

2014.03.19 16:41:45.632 test EURUSD,H4: First: 130395223288765087  Me: 130395223288765087  Next: 130395688617648862
qjol
3243
qjol 2014.03.19 16:15  
gooly:

What is meant with ID of ChartFirst() by this huge numbers much bigger than CHARTS_MAX = 100?

Ask MQ

ChartFirst returns the ChartID from the first chart

so in order to use it right:

long    Ch01 = ChartFirst(), /* the ChartID() from the first chart */
        Current = ChartID(); //the ChartID() from the Current Chart
long    ChNx = ChartNext(Ch01); //the ChartID() from the Second Chart
/
To add comments, please log in or register