Advertisement IC Markets

Clock drift: when the VPS thinks it's a different second

Discuss 1-minute to 15-minute price action setups, fading intraday momentum, key support/resistance zones, and proven short-term trading methodologies.
Post Reply
Shadow Trader
Posts: 5594
Joined: Wed Sep 09, 2026 5:19 pm

Clock drift: when the VPS thinks it's a different second

Post by Shadow Trader »

For news trading, timing is everything. A script that fires an order at 8:29:59.8 needs a clock that's accurate to within milliseconds. Many computers aren't.

Windows synchronizes its clock with a time server only periodically, often once a week by default. In between, the clock can drift by a second or more. A VPS can have its own issues, with virtualized clocks that drift faster.

An order scheduled for the second before a release but sent a second late lands in the middle of the spread explosion. An order sent a second early might trigger before the data and get a poor fill.

The fix is to run a time synchronization tool that updates frequently, ideally with a reliable source. Checking the offset against a reference clock and against the broker's server time reveals the error.

Broker server time and local time can also differ by seconds. Logging both, and comparing at the moment of an order, shows the real delay.

For manual trading, a second's error doesn't matter. For automated news systems, it determines whether the logic works.

Server time offsets add another layer. Some brokers' servers run a few hundred milliseconds ahead of or behind true time, so an order that appears to leave at exactly the right second still lands late or early compared to the market's actual clock. Logging the broker's server timestamp on the order confirmation against a reference time source reveals the offset.

For strategies that need precision, such as placing orders in the second before a scheduled release, the combined clock error from the PC, the VPS, and the broker can reach a second or more. Measuring and correcting for it takes an afternoon and removes a hidden source of randomness.

How far off is the VPS clock from a reference, and has it ever caused a mistimed order?
Recommended broker for automated trading & scalping IC Markets
FXS Prop Desk
Posts: 1692
Joined: Wed Oct 07, 2026 9:52 am

Re: Clock drift: when the VPS thinks it's a different second

Post by FXS Prop Desk »

Shadow Trader wrote: A script that fires an order at 8:29:59.8 needs a clock that's accurate to within milliseconds.
The weekly default sync is the detail most people never change. On Windows the interval can be shortened through the registry, or a small NTP client can keep it within milliseconds. For a script firing at 8:29:59.8, anything less precise means the order timing is a guess.
FXS Official Team | The Idea Lab & Strategy
Amanhasnoname
Posts: 2060
Joined: Fri Oct 30, 2026 9:45 am

Re: Clock drift: when the VPS thinks it's a different second

Post by Amanhasnoname »

I had a news script on a VPS that kept entering what looked like a second late, and for weeks I blamed the broker. When I finally compared the VPS clock to an online reference, it was running about one and a half seconds behind. Windows had been syncing once a week and the virtual machine drifted much faster than my home PC.

I installed a small NTP client set to sync every few minutes and added a log line that records local time, broker server time from the order confirmation, and the reference offset on every trade. The drift dropped to a few milliseconds, but the log also showed the broker server itself ran around two hundred milliseconds ahead of true time.

Fixing both changed my results on the scheduled releases more than any tweak to the entry logic. The script now fires based on the corrected time, and the fills stopped landing in the middle of the spread blowout. It took one evening to set up and I wish I had done it on day one.
Post Reply