Broker time and the trading day
One clock inside Forge
Every time inside Forge and in storage is UTC, counted in nanoseconds since the Unix epoch. A local time is never stored. On the wire, times are milliseconds since the epoch.
Broker server time is a different thing. A broker's terminal shows its own clock, often ahead of UTC by a few hours, and it can move when the broker starts or ends daylight saving. Forge reads the broker's offset from the broker facts of the run and converts. Your code can ask for the broker's clock or a named zone, and the answer is always the simulated time of the run.
Your broker's clock in a test
A test in Oathra's New test reads your broker's clock from your price data, or you set it: an offset from UTC, with or without daylight saving. The test's day starts at 00:00 on that clock, the swap is charged at that clock's midnight, and each trade shows the time its entry and its exit filled on that clock. With no broker clock, the test's day starts at 00:00 UTC. The test's day never follows your device's time zone.
A test run again from one made before this change starts its day on your broker's clock.
Where a day starts
Each series states where its trading day starts. The default depends on the market. The day of a test is set as above.
| Market | Day starts |
|---|---|
| Forex | 17:00 New York |
| Exchange instruments | The venue's own session |
| Markets open all week, such as crypto and broker synthetic indices | 00:00 UTC |
The forex default is a default, not the only choice. Every bar that spans a day uses the day start of its series, and so do the day and week hooks of a strategy.
Markets with no day boundary
A market that never closes has no natural end of day. Forge still needs one for daily statistics, and it uses the day start of the series.
Closures
When a market closes, a grid bar can continue its grid or reset it across the gap. The series says which. A time bar ignores this setting.