MetaTrader does not have historical records for the session times nor DST nor time-zone changes.
The Strategy Tester always uses the current DST and the session times as reported in the current contract specifications for the entire test period.
Forum on trading, automated trading systems and testing trading strategies
TimeDaylightSavings Doesn't Work On Backtesting
Fernando Carreiro, 2023.11.12 11:48
There are limitations when simulating time in the Strategy Tester. No historical records are kept for time-zone and daylight savings, so they cannot be simulated.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I've been using an specific broker for not that long, like 5 months. I've developed my own EA and until a few weeks ago I noticed every now and then, not always, during my backtesting I would see ticks starting at 13:00 hours but the Symbol Specification in MT always showed quotes and trading starting Mon-Fri 1400. So I just thought Mr @Fernando Carreiro was right when they said:
> Just because there are ticks during a certain period that does not mean that a broker allows trading during that period.
in here: https://www.mql5.com/en/forum/369755#comment_22461818
and live moved on, I added a check in my EA to get the session trading hours by calling SymbolInfoSessionTrade() and would not place trades before 13:00 as the symbol spec showed trades starting at 14:00. As suggested by the other guru in this forum(@Alain Verleyen) here: https://www.mql5.com/en/forum/377165#comment_24494019
Well, everything changed recently with DST in the place where my broker is located and now if I right click the same symbol in the Market Watch, Specs, the trades start at 13:00 hours, no longer 14:00.
So I have two problems now:
Problem number #1 is what really concerns me. is it correct that MT5 during BT will use the current symbol trading hours as the truth about trading hours? If so, is there any way to get consistent backtests? In case the problem is still not clear let me explain it:
The symbol I'm working on usually starts trading at 14:00 hours. But during some part of the year it starts at 13:00 hours. This is according to the Symbol Specs in MT5. Now, if right now, I would run a BT back in 2020 when the trading hours started at 13:00 I would see orders being placed 13:00 onwards. Let's just say I would see 10 trades in a single day in 2020. Now, eventually my broker will change the symbol trading hours again to 14:00 and if then I run the same BT, on the same date, my EA would get Market Closed errors if it would try to place an order before 14:00. So in that same day I would see less than 10 orders.
It seems to me that the only way to have a reliable BT is to run it during the time of the year when the trading hours are equal or greater than trading hours in the past. Does that make sense?