Backtesting

How replay works

The mental model behind tick-by-tick replay, and why a few things behave the way they do.

StrategyTune's replay is built around one idea: show you the market the way it actually arrived, not a sanitized version of it. That means tick-by-tick prices, not just OHLC candles, and a clean separation between "the market state right now" and "the most recently closed bar."

The mental model

Every step of the replay produces one momentum bar. A momentum bar carries:

  • The current bid and ask quote (always).
  • A candle update (sometimes — only when a new bar closes).

So between two candle closes you'll see many momentum bars: each one moves the price forward, fills pending orders if their level was crossed, repaints the chart's "live" bar, and updates your unrealized P&L. The chart looks the way it would have looked in real time, not like a stitched-together sequence of complete candles.

This is what we mean by tick-by-tick. "1×" speed walks through every tick. Higher speeds skip nothing — they just emit momentum bars faster. There are no synthesized intra-bar paths, no random walks between O/H/L/C; the order matches the historical tape.

A few behaviours worth knowing

The replay engine is built to stay out of your way. A few specifics:

  • Speed changes are instant. Switching from 100× to 5,000× while a replay is running takes effect on the next tick — no rewind, no reload.
  • Scrubbing pauses first. Dragging the timeline auto-pauses, jumps to the target time, and resumes if you let go while it was running. This avoids fighting you for control.
  • You can't trade between ticks. Order placement is briefly suspended during the instant a price tick is being applied, so a fill can't happen on the same tick the order was created. This keeps the simulation honest.

The replay loop

  1. Load the next price tick.
  2. Apply it: update the live candle, run any indicators, evaluate pending orders, mark P&L.
  3. Wait the right amount based on your current speed.
  4. Repeat — until you pause, hit the end, or scrub elsewhere.

Most of the time you don't need to think about any of this. But when something behaves unexpectedly — a stop fills at a worse-looking price, or a price flickers without the candle changing — it's almost always because you're seeing a quote-only tick rather than a new candle. That's the engine being precise, not buggy.

What you control vs. what's deterministic

You controlThe engine controls
Security, date range, intervalThe order ticks arrive in
Replay speed and direction (jump)When candles close
When to enter / exit a tradeWhether your stop or limit was crossed
Indicators on the chartPer-bar lifecycle (init, per-bar, per-tick)

Something missing or wrong? Email support@strategytune.com.