CopyRates result index

To add comments, please log in or register
samjesse
645
samjesse  

Hi

This mql5 code prints the oldest bar info first. 

How can I get array indexed so that the current bar on the chart is in index 0 and thus prints out first?

Thanks

MqlRates rates[20];
CopyRates(_Symbol, PERIOD_D1, 0, 19, rates);

for(int i=0; i<20; i++){
   Print(rates[i].high);
}
Ernst Van Der Merwe
5752
Ernst Van Der Merwe  
MqlRates rates[];
ArraySetAsSeries(rates,true);
CopyRates(_Symbol, PERIOD_D1, 0, 20, rates);
for(int i=0; i<20; i++){
   Print(rates[i].high);
   }
To add comments, please log in or register