Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Actually, that is what they instruct in the documentation as I noted above in my post.
Forum on trading, automated trading systems and testing trading strategies
Direction of OnCalculate() in MQL4 and MQL5
Fernando Carreiro, 2017.01.22 18:12
Also, according to the documentation, and I quote:
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
static bool HasRun=false;
if(!HasRun)
{
printf("Default: time[0]=%s time[rates_total-1]=%s",
TimeToString(time[0]),TimeToString(time[rates_total-1]));
ArraySetAsSeries(time,true);
printf("ArraySetAsSeries(true): time[0]=%s time[rates_total-1]=%s",
TimeToString(time[0]),TimeToString(time[rates_total-1]));
ArraySetAsSeries(time,false);
printf("ArraySetAsSeries(false): time[0]=%s time[rates_total-1]=%s",
TimeToString(time[0]),TimeToString(time[rates_total-1]));
HasRun=true;
}
return(rates_total);
}
In MT5:
In MT4:
Conclusion:
In MT5 default oldest index is [0]
In MT4 default oldest index is [rates_total-1]