Exchange time v machine time

Questions about MultiCharts and user contributed studies.
brianhclo
Posts: 31
Joined: 31 Mar 2014
Has thanked: 8 times

Exchange time v machine time

Postby brianhclo » 22 Oct 2015

Currently I am running a few strategies that enter/exit the market when conditions are meet at a specific time.

i.e. If time_s = TimeA then begin .....

the problem is that sometimes time_s actually follows the time on my windows machine, and there are occasions where there is a few seconds difference between my machine and the broker. Therefore there were times where the market was already closed when an order is placed.

Instead of using machine time, can I call the exchange time from my broker (interactive brokers) and use that as a trigger instead?

Thanks,
Brian

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Exchange time v machine time

Postby TJ » 22 Oct 2015

Currently I am running a few strategies that enter/exit the market when conditions are meet at a specific time.

i.e. If time_s = TimeA then begin .....

the problem is that sometimes time_s actually follows the time on my windows machine, and there are occasions where there is a few seconds difference between my machine and the broker. Therefore there were times where the market was already closed when an order is placed.

Instead of using machine time, can I call the exchange time from my broker (interactive brokers) and use that as a trigger instead?

Thanks,
Brian
Unfortunately EasyLanguage does not have a keyword to access the broker time.

Even if EasyLanguage could get the time, I doubt it would be of any help, because the broker's server time is most likely sync'd to the internet the same way your computer does. So the quotation time difference is in the internet latency between you can your broker.

There is ALWAYS a latency, even if you are sitting on the exchange floor.
The latency depends on the distance between you and your broker, it is measured in "hops" and milliseconds. With today's high speed internet, the delay shouldn't be too bad (unless you are in a rural area).

You can do a ping test to find out how much your latency is. (see IB's website for instruction).

If you are looking to place an order at the end of the day,
most brokers advise traders to allocate a 3 minutes' time window.


ps. IB has 3 servers located around the world (Hong Kong, USA, and UK), make sure you are connected to a server that is close to you. It will reduce the latency a bit.

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Exchange time v machine time

Postby TJ » 23 Oct 2015

Currently I am running a few strategies that enter/exit the market when conditions are meet at a specific time.

i.e. If time_s = TimeA then begin .....

the problem is that sometimes time_s actually follows the time on my windows machine, and there are occasions where there is a few seconds difference between my machine and the broker. Therefore there were times where the market was already closed when an order is placed.

Instead of using machine time, can I call the exchange time from my broker (interactive brokers) and use that as a trigger instead?

Thanks,
Brian
if the symbol you are trading is slow moving,
make sure you have added this keyword to your code:

RecalcLastBarAfter


Return to “MultiCharts”