← Learn

What happens when a stop and a target are both hit inside one candle?

Updated 21 September 2026 · Versión en español

Nobody can tell from the candle. A bar records its open, high, low and close — not the order in which the high and the low happened. When both the stop and the target sit inside one bar, a backtest has to choose which was hit first, and the rule it chooses moves every result on short timeframes. TradingZona's backtest takes the level nearer to the entry; its live robots look at finer data and do not need to guess.

The four rules, and what each does to a backtest

RuleEffect on results
Always the stopConservative, and biased: every ambiguous bar becomes a loss, so the backtest understates the strategy — sometimes badly.
Always the targetThe opposite bias: every ambiguous bar becomes a win. The most flattering choice, and the most dangerous.
Infer a path from the barTradingView's broker emulator assumes open → high → low → close when the open is closer to the high, and open → low → high → close when it is closer to the low. A reasonable guess about the path, still a guess.
Nearer level firstPrice has less distance to travel to reach the closer level, so it is taken as the likelier first touch. Removes the one-sided bias; can still be wrong on any given bar.

The only way to know is finer data: one-minute bars, ticks, or a live price feed. TradingView calls its version of that the Bar Magnifier.

A worked example

A long at 100. One bar later the candle's low is 96.5 and its high is 101.5 — both levels were touched.

Stop · targetAlways stopAlways targetNearer level
98 · 101 (stop 2 away, target 1 away)−2+1+1 — the target is nearer
99 · 101.5 (stop 1 away, target 1.5 away)−1+1.5−1 — the stop is nearer
99 · 101 (both 1 away)−1+1−1 — a tie goes to the stop

On the first row the same candle is a loss of 2 or a gain of 1 depending only on the rule. If the levels of a strategy regularly fit inside one typical candle of the timeframe you are testing, the result is telling you about the rule more than about the strategy — a sign that the timeframe is too coarse for those levels.

What TradingZona does

In backtests, when both levels are inside one bar, the one closer to the entry wins, and a tie goes to the stop. Liquidation is checked before either, because a venue force-closes first. The rule was chosen to remove the systematic downward bias of "always the stop", not to flatter anything.

In live robots, the exit engine resolves exits in three tiers: a live mark-price stream (milliseconds, and the price perpetual futures actually liquidate on), then one-minute candles replayed — which know the real order of the high and the low, and backfill anything missed across a disconnect or a redeploy — and only if neither is available, the robot's own timeframe with the same nearer-level rule as the backtest. So live and backtest disagree only where live knows better, and every outcome records which tier decided it.

Sources

TradingZona is research and signal software. It places no orders, it is not a broker and it is not investment advice. A backtest is hypothetical: past or simulated performance does not guarantee future results. Trading involves substantial risk of loss.