Tommy Wang:
How are people handling this?
How are people handling this?
TimeGMT library for the strategy tester
amrali, 2024.02.22 01:54
Static class to fix the TimeGMT() function during testing in the strategy tester.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
Most brokers on GMT+2/+3 server time follow the US DST schedule so the daily close stays at 17:00 New York. Europe ends DST on 25 October and the US on 1 November, so for that week London opens one hour earlier in server time than usual. The same thing happens in March in reverse.
For EAs that build an Asian range from fixed server hours and trade the London breakout, the range window and the London open are misaligned for about a week, twice a year.
How are people handling this?
1. Keep fixed server hours and accept that week
2. Work out session times from GMT (TimeTradeServer() minus TimeGMT()) plus an internal DST table
3. Skip trading during the mismatch weeks
The catch with option 2: in the Strategy Tester, TimeGMT() returns the simulated server time, so the offset logic behaves differently in backtests than live unless the offset is hard-coded by date. Has anyone found a clean way to keep this reproducible in the tester?