Reply

Handling the Time Zone Issue: Step by Step

0 replies

afhampton

Customer, bbp_participant, community, 26 replies.

Visit profile

6 years ago #117877

I have read through every post I could find on the forums regarding time zones so that SQ and MT4 back tests function properly but am still at a loss.  So this is more of a request to those experienced users of SQ to help write a simple, easy to follow guide of how to get this right. As all of us know, not compensating for time zones correctly, and for whether particular region is in Daylight Saving Time or not can have a huge impact on your trading results. The “perfectly” designed EA can fail miserably because it is trying to trade in the wrong time windows. So let’s ensure that we know how to prevent that.

 

Let’s establish some parameters for our exercise:

1. The broker’s price data is stored at whatever GMT offset they have configured on their server. This may or may not match the actual time zone in which their server resides (e.g. Traders Way)

2. The Dukascopy data is stored at GMT +00:00. This is also the default time zone of the data provided in SQ and that also comes from Tick Data Downloader if it isn’t adjusted.

3. For this exercise, the broker’s time zone is GMT +2:00 / GMT +3:00 (when in DST). The DST region is Europe. The servers are set to roll over the day with a time of 00:00 at 5 pm Eastern (GMT -5:00 / GMT -4:00)

4. For this exercise, the trader’s time zone is GMT -5:00 / GMT -4:00 (when in DST). The DST region is the US.

 

There are several key topics I would like to ask for clarification on how to handle.

1. Let’s assume that SQ generates an H1 strategy using the Dukascopy data it has downloaded and finds the best time to trade this strategy is GMT 08:00 – GMT 12:00. In the Eastern time zone during DST, this is equal to 03:00 – 07:00 AM.

 

Question:

When the strategy is tested on the MT4 client and it uses the broker’s .fxt and .hst files, will the trades be executed at the broker’s 08:00 – 12:00 hours (which is actually GMT 06:00 – GMT 10:00) or will they be executed at the correct time of 10:00 – 14:00 (i.e. GMT 08:00 – GMT 12:00)?

 

Answer (Is this correct?):

By default, when an EA built by SQ is ran on the MT4 client, it looks at the time provided in the MT4 client, which is the broker’s time (not the trader’s local machine time), and uses it as the filter for when to execute the trade. So in our case above, it would execute the trades at the broker’s 08:00 – 12:00 hours – which is two hours early. Unless the broker’s server’s time is set for a new day to begin at GMT 00:00, then the times will be off by the broker’s GMT offset, which may result in trades taken outside of the window identified by SQ. To compensate for this, the trader or the EA needs to calculate the GMT offset and adjust the trade window within the EA code so that it selects the right trade windows per the broker’s server time.

 

The other alternative is to import a data file that has the times adjusted to the broker’s server time already. If the strategy is built on that data with adjusted times, then it should also execute in real time at the appropriate time.

 

Next scenario…

I have been using Birt’s Tick Data Suite (TDS) for a few weeks now and have downloaded tick data on numerous pairs from 2003 – 2017. The data comes from Dukascopy, so it is the same data that SQ uses. I use this for most of my strategy testing on MT4 since it is as close to the market as I have been able to get and it produces 99% Quality on MT4 backtests (not that I give that rating much weight … but it is better than 90% or lower .. which is the highest I have ever gotten from broker data).

 

Question:

1. Can I use the tick data that I have already downloaded for TDS (which also comes from Dukascopy) for my SQ strategy generation?

 

Answer:

The answer to this is yes. TDS comes with the Tick Data Manager. It’s TDM that downloads the tick data from Dukascopy. You can export the tick data from TDM as a single CSV file that can be imported into SQ. The export can’t be set to a particular time frame such as M1, H1, etc. It is the actual tick data, so the export file will be sizable. You can also set the GMT offset and DST region to your broker’s server so that the data is automatically adjusted in the CSV file.

 

Next scenario…

When you get ready to import the data you have exported from TDM into SQ, be sure to use Karish’s script to set up the symbol correctly. The Point Value in $ has to be correct for the results to be correct. His script can be dropped on a chart in MT4 and will give you all of the values you need to set up the symbol correctly. One note to remember, the spread will be displayed in points (not pips). So when you see something like 35 for the spread, it is actually 3.5 pips. Here’s a link to his post and the tool.

 

https://strategyquant.com/forum/topic/6113-tool-find-the-point-value-in-in-just-1-click/

0