NOONOO TRADINGStart in the bot

When a Target and Stop Both Touch in the Same Candle: Hidden Backtest Inflation

The guide opens with an illustrative backtest win rate changing from 68% to 41% after one engine setting changes. It is not necessarily a coding bug: the setting determines how trades touching both target and stop within one candle are resolved. This is a common gap in candle-based backtesting.

Candles do not remember the sequence

An hourly candle retains only four values: open, high, low and close. The order of movement during that hour is absent.

One candle, two completely different paths

Hourly OHLC: 100.0, 102.4, 98.6, 100.2.

Path A:
100.0 → 102.4, high first → 98.6 → 100.2.

Path B:
100.0 → 98.6, low first → 102.4 → 100.2.

The candle looks identical.
For a target of 102 and stop of 99:
A reaches the target; B reaches the stop first.

The engine knows the high exceeded 102 and the low broke 99, but the data does not reveal which occurred first. It must apply an assumption that produces the result.

Three engine assumptions

Common approaches include these three. Unless you check the default, you may interpret numbers without knowing their basis.

① Optimistic: Target first
Both touched → count the target.
→ Raises the modeled win rate.

② Pessimistic: Stop first
Both touched → count the stop.
→ Produces the lower sequencing scenario.

③ Probability allocation or randomization
Allocate half to each exit, or randomly select.
→ A middle scenario, with randomized results changing on repeated runs.

Precaution:
The original guide warns that tools may silently use ①,
making a strategy look more promising.

Of these, ② provides the conservative sequencing scenario. Result ① means the most favorable ordering, and relying on it for live capital can immediately disappoint. It resembles lookahead bias by allowing unknown intrabar information to influence results.

The ambiguous proportion determines the uncertainty

The central question is how many trades are affected. A low fraction has less impact; a high fraction can destabilize the entire conclusion.

Detailed example: 200 trades
34 touch both exits.
The other 166 contain 102 confirmed winners.

Optimistic:
Wins = 102 + 34 = 136.
136 ÷ 200 = 68.0%.

Pessimistic:
Wins = 102 + 0 = 102.
102 ÷ 200 = 51.0%.

Half to each:
Wins = 102 + 17 = 119.
119 ÷ 200 = 59.5%.

Same data and rules; a 17-percentage-point range.

At 1:1 risk/reward, breakeven is around 50% before costs. This example looks strong under optimistic ordering and near breakeven under pessimistic ordering. See risk/reward and expectancy and R multiples.

Why does ambiguity increase?

It depends on the setup, not merely chance. Two factors increase the affected proportion.

Exit distances relative to volatility

Illustrative hourly range, discussed alongside ATR: 2.0%.

Target +3.0%; stop −3.0%.
→ Both are hard to reach in one typical candle; low ambiguity.

Target +0.6%; stop −0.6%.
→ Combined 1.2% fits inside the 2.0% average range;
ambiguity can increase sharply.

If target distance plus stop distance is smaller than typical range,
many candles can contain both exits.
Larger timeframes conceal more ordering

Replay the same +1% target and −1% stop:

One-minute range 0.15% → illustrative ambiguity below 1%.
15-minute range 0.6% → about 6%.
Hourly range 2.0% → about 17%.
Daily range 4.5% → above 30%.

Larger candles conceal more elapsed time
and more internal sequence information.

Narrow-target short-term strategies are especially exposed. Using large candles can produce ambiguity above 30%, making the report resemble assumption-driven coin flips presented as strategy performance. This is common when validating scalping rules.

Measure ambiguity in your own backtest

Count it directly from your logs rather than borrowing someone else's frequency.

Five measurement steps

Record entry, target and stop for each trade.
Attach the exit candle's high and low.
For a long, count high ≥ target AND low ≤ stop.
For a short, check the corresponding target-below and stop-above conditions.
Ambiguous proportion = count ÷ total trades.
Run both optimistic and pessimistic versions and record the win-rate difference.

The guide's reference ranges:
Below 5% → relatively small effect.
5–15% → emphasize the pessimistic scenario.
Above 15% → insufficient basis for judgment;
use lower-timeframe or tick replay.

Step ⑤ is central. The gap measures uncertainty from sequencing, so report the range rather than one win rate.

Responses, starting with the least expensive

① Fix pessimistic ordering: No additional data cost
Count all ambiguous cases as stops.
→ Profitability here provides a stronger conservative starting point.

② Replay a lower timeframe: Lower cost
Generate signals hourly but evaluate exits with minute bars.
→ In the illustration, ambiguity falls from 17% to below 1%.
→ Often sufficient for the next validation step.

③ Replay tick and execution data: Higher cost
Follow actual recorded transaction order.
→ More precise, but data acquisition and processing are heavier.

④ Widen the exit distances: Changes the strategy
Make the combined distance larger than the typical candle range.
→ Reduces the ambiguous region but creates a different strategy.

The guide suggests screening with ① and examining surviving candidates with ② before spending more on tick data. See backtesting, walk-forward analysis and overfitting for the broader process and dangers of repeatedly changing conditions to fit results.

Live execution introduces further unfavorable differences

Resolving candle order does not close every gap between historical simulation and live trading. Remaining differences commonly act against the trader.

Generous backtest assumptions

• Stops fill exactly at the level, despite real slippage.
• Limits always fill, despite a brief touch leaving them unfilled.
• Intermediate prices are available during gaps or sharp moves.

Stop at −1.0%; actual fill at −1.15%:
100 such exits at $5,000 notional.
Additional loss each = 5,000 × 0.15% = $7.5.
Total over 100 = $750.

That cost must be deducted from the modeled outcome.

Assess ambiguity and execution assumptions together. Conservative ordering and adverse fill assumptions provide a stronger basis for choosing candidates for further validation. Paper trading checks operation without live account exposure; see sample size for sufficient observations.

Recap

Candles retain four prices and lose internal order.
Both exits touching forces an assumption.
Check for a silently optimistic default.
The detailed example yields 68% versus 51%, a 17-point gap.
Combined exit distance relative to candle range affects ambiguity.
Narrow targets and large candles increase it sharply.
Above the guide's 15% reference, seek better data before concluding.
Begin with pessimistic ordering.
Next replay exits at a lower timeframe.
Report the optimistic-to-pessimistic range, not one win rate.

A backtest win rate can contain cases the data cannot resolve, and the engine's assumptions can dominate the report. Before examining a new strategy's equity curve, count ambiguous trades. A large fraction, above 15% in this guide's reference, can describe the engine setting more than the strategy.

NOONOO TRADING invites you to follow live trading in our free chat.

Start in the bot

📈 OKX trading fee discount for new registrations

Register for the OKX Fee Discount →