Bar or tick mode
Tick vs bar backtest: what each mode replays inside a minute, the four places their results can differ, and which mode to use when.
Video tutorial · D2 · on YouTubeBar or tick mode
How it worksThe execution modelWhat bar mode assumes inside a minute
How it worksThe execution modelWhat tick mode replays, and how it fills
How it worksOrders and fillsHow a stop loss and a take profit are checked and filled in each mode
The two modes
Every backtest picks a Data mode:
- Bar by bar (M1) steps through the 1-minute candles, once per candle. It knows each minute's open, high, low and close, but not the order in which the price moved between them. It is the faster mode.
- Tick by tick replays every recorded tick, in time order, with each tick's own bid and ask. It is the slower mode, and the reference.
What each mode sees inside one minute:
| Inside one minute | Bar by bar (M1) | Tick by tick |
|---|---|---|
| Prices | the open, high, low and close, once | every tick, in the order it happened |
| Spread | the minute's average | each tick's own |
| Rules that run on every tick | once, at the minute's close | on every tick |
| A market order | fills at the next minute's open | fills at the tick where the rule fired |
| A stop loss or take profit | tested against the minute's high and low, filled at its level (a stop the minute opens beyond: at the open) | tested on every tick, filled at that tick's price |
Where results can differ
The same strategy on the same dates can give different trades in the two modes. It happens in four places:
- A stop and a target inside the same minute. When a minute's range reaches both, bar mode cannot know which came first and assumes the stop did. Tick mode sees the real order.
- A price that gaps through a level. Both modes make you pay a gap through a stop: it fills at the first price past the level, the minute's open in bar mode. Through a take profit or a limit order, bar mode fills at the level, while tick mode fills at the first price past it, which is better.
- A rule that runs on every tick. In bar mode it runs once a minute, at the candle's close.
- A market order. Bar mode fills it at the next minute's open. Tick mode fills it at the exact tick where the rule fired.
Bar mode approximates the inside of each minute
The tighter your stops and targets, and the more your rules react to every tick, the more a bar-mode result can differ from tick mode and from live trading.
Which to use when
- Explore in bar mode. It is fast, so it suits first drafts and wide parameter sweeps.
- Confirm in tick mode before you trust a result or deploy it. Tick mode is the reference: it is the mode compared trade by trade with the MetaTrader 5 Strategy Tester.
- Use tick mode from the start when the strategy places tight stops, targets or pending orders, or acts on every tick.
Who can use which
- Bar mode is on every plan, and it is the default in the run dialog.
- Tick mode is on every plan too, the trial included, over the full history.
- In a sweep, a tick-mode run costs 5 times the test-years of a bar-mode run over the same dates, more when the strategy checks conditions on every tick (Plans and usage).
Questions?support@algotradinghub.io