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

 
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?
 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
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.