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 changes between winter and summer time. 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.
Where a day starts
Each series states where its trading day starts. The default depends on the market.
| 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.