If you try to look at a bar which is outside the time interval you're backtesting

rupert65  
Could I possibly ask for clarification about something. Suppose you were doing a backtest on a particular time interval and you were on the very first bar of that time interval, and then your code called a function trying to look at the previous bar. Does that mean that MT5 would get data from outside the time interval of your backtest?
Fernando Carreiro  
rupert65: Could I possibly ask for clarification about something. Suppose you were doing a backtest on a particular time interval and you were on the very first bar of that time interval, and then your code called a function trying to look at the previous bar. Does that mean that MT5 would get data from outside the time interval of your backtest?

Usually on the first bar of the test period, the Strategy Tester will provide access to some bars before that. I think it is somewhere in the range of 1000 bars (provided that data is actually available from the broker).

In your EA code, use the iBars() function for example, to see how many bars are available.

Reason: