Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
The Strategy Tester simulates the same market sessions as if it were live. This helps you test your EA to properly handle those situations.
For example in Forex, usually the market is closed during 10 to 15 mins during which brokers calculate their swaps. It depends on the brokers time-zone, but it is usually during the end of the day and the beginning of the next.
During this time, orders can not be placed. If you trade on the daily chart, you have to wait a few minutes before you can place your first trade of the day, and this is simulated in the Strategy Tester.
EDIT: I am referring to the historical data timing, not the broker's current live time.
Forum on trading, automated trading systems and testing trading strategies
Forex time and Backtest operations during Weekends
Fernando Carreiro, 2021.06.12 02:34
No, not every candle is tradable! Just as I wrote, there times on any symbol, not just Forex, that no trading is allowed. When you pull up the contract specifications for a symbol, you can see at which times the sessions close for trading.
You should use the MQL function SymbolInfoSessionTrade() to obtain data about these sessions and prevent your EA logic from trying to place orders or manage existing positions during those periods.
Also, the only reasons to close positions on a Friday night and open them again on a Monday morning, is if you wish to manage opening weekend gaps or reduce swap costs. If you are trying to reduce swap costs, then you would also need to close positions a few minutes before midnight and reopen them again a few minutes after midnight every day of the week. This is especially important on Wednesday night where triple-swaps are applied.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I tried to debug EA in MetaEditor 5.0 (Start/Resume debugging on History data). Debugging works well but calling CTrade::PositionOpen results 'Market closed' error. I am debugging on history data, why market must be open? In reality, market is now open, but it doesn't work. I thought that system can read history tick data from file and simulate ticks like ticks coming from live broker regardless of market status. But obviously it can't. What is the purpose of 'Start/Resume debugging on History data' if it requires live broker?