ox-charts

Bar-close execution, and why it matters

Live strategies act when a bar closes, not on every tick, so live orders match the backtest.

crossgonecrossBar closescross ✓Order sentForming bar: intents dropped
While a bar forms, a crossover can appear and vanish. The order goes when the bar closes and the signal is final.

A script re-runs on every tick of the forming bar. A crossover that appears at 10:14:20 can disappear by 10:14:59 if price pulls back. The backtest only ever saw closed bars, so a strategy that traded mid-bar would take trades its backtest never took.

  • Intents from a forming bar are dropped. The closed bar's intents arrive with the next update and go through.
  • History never emits orders in live modes: arming a strategy does not replay past signals.
  • The same signal is never sent twice. Each intent has a content key (script, symbol, interval, bar time, order) that becomes the broker's client order id.
  • Tick execution (Settings → Automation) lets forming-bar intents through, for calc_on_every_tick scripts. Expect live results to drift from the backtest.

What it costs

Acting at the close means entering up to one bar later than an intrabar signal. On a 5-minute chart that is at most five minutes. In exchange, what you backtested is what trades.