Download MetaTrader 5

Enumeration of the bars

To add comments, please log in or register
24h-worker
86
24h-worker  

I tested the new programming construction

 

     CopyOpen("EURUSD",PERIOD_H1,0,5, XY); // 5 bars from 0 - 4

 

XY[0] // this is the oldest bar - the fourth bar

 

In MQL4 the [0] was the newest. In my test it was the oldest.

 

Will that enumeration be changed or is that the finall status ? 

Wackena
648
Wackena  
24h-worker :

I tested the new programming construction

 

     CopyOpen("EURUSD",PERIOD_H1,0,5, XY); // 5 bars from 0 - 4

 

XY[0] // this is the oldest bar - the fourth bar

 

In MQL4 the [0] was the newest. In my test it was the oldest.

 

Will that enumeration be changed or is that the finall status ? 

Had the same problem. I believe it was Stringo from MetaQuotes that advised what to do.  To implement 1 = 1 bar back, 2 = 2 bars back and so on just call ArraySetAsSeries(XY,true);


ArraySetAsSeries(XY,true);

CopyOpen("EURUSD",PERIOD_H1,0,5, XY); // 5 bars from 0 - 4


Hope it works.


To add comments, please log in or register