Rates position

 

Hi

I'm traying to make this work, but can make it work propperly.

I use this:

   MqlRates rates[];
   ArraySetAsSeries(rates,true);
   int copied=CopyRates(_Symbol,PERIOD_CURRENT,0,7,rates);
   if(copied<=0)
     Print("Error copying price data ",GetLastError());

but when testing this:

      if(rates[6].close>array_ma1[6])

My q is: 6 is the last rate or is it the first one (7 rates ago)?

 

Learn to use F1 in the Editor: place cursor on CopyRates and press F1, then you see the direction of the array.

Beside this check the time in the structure of MqlRates.