A long trade has its stop 1% below entry and its target 2% above. The next one-hour bar has a low below the stop and a high above the target. Did the trade win or lose?


From the bar alone you cannot know. A candle records four prices (open, high, low, close) and nothing about the order the high and the low came in. Every backtest and every simulator that works from candles has to guess, and the guess can be worth more than the strategy.
We measured how often the guess decides the trade, which way the real path went, and how far each common assumption moves the result, on six and a half years of Bitcoin and Ether candles.
What happens when the stop and target are in the same candle?
The backtester picks an order for the high and the low. There are four common choices:
- Stop first. Every ambiguous bar is a loss. Pessimistic by design.
- Target first. Every ambiguous bar is a win. The flattering choice, and the one to be suspicious of.
- Nearest extreme first. The price goes from the open to whichever of the high and the low is closer, then to the other, then to the close. This is a model of how bars usually form, not a recording.
- Look inside the bar. Use lower-timeframe candles, or ticks, to see which level was actually touched first.
The first three are assumptions. Only the fourth is data, and even it runs out: a 5-minute candle can also contain both levels.
How often does it happen?
The test: on Binance BTC perpetual futures from 1 January 2020 to 20 August 2026, we opened a long and a short at the open of every 1-hour bar and every 4-hour bar, with the stop and target a fixed percentage from the entry. Each trade ran on its own timeframe until one level was touched. A trade counts as ambiguous when the bar that decided it touched both. Bars that gapped through a level were resolved at the open and not counted.
| Timeframe | Stop / target | Trades | Decided on a bar that touched both |
|---|---|---|---|
| 1h | 0.5% / 1% | 116,342 | 3.3% |
| 1h | 1% / 2% | 116,334 | 0.5% |
| 1h | 2% / 4% | 116,324 | 0.1% |
| 4h | 0.5% / 1% | 29,086 | 14.8% |
| 4h | 1% / 2% | 29,084 | 3.2% |
| 4h | 2% / 4% | 29,082 | 0.4% |
What drives the share is the stop distance relative to the size of a bar. The median 1-hour BTC bar in this period spans 0.65% from high to low; the median 4-hour bar spans 1.38%. A 0.5% stop on 4-hour bars sits well inside a normal candle, and one trade in seven ends on a bar that covers both levels.
Ether moves more per bar (median 0.88% on 1h, 1.88% on 4h), and the share rises with it: 5.2% of trades on 1-hour bars and 22.1% on 4-hour bars at 0.5% / 1%. Gold, which we tested over the two years of data we hold (August 2024 to August 2026), had far less of it: 0.3% of trades on 1-hour bars and 2.1% on 4-hour bars at 0.5% / 1%, and none at 2% / 4%.
Which one was hit first?
For every ambiguous trade we opened the 5-minute candles inside the deciding bar and walked them in order.
| Timeframe | Stop / target | Stop first | Target first | Still both in one 5m bar |
|---|---|---|---|---|
| 1h | 0.5% / 1% | 58.8% | 36.5% | 4.7% |
| 1h | 1% / 2% | 52.9% | 43.3% | 3.8% |
| 4h | 0.5% / 1% | 65.3% | 33.3% | 1.4% |
| 4h | 1% / 2% | 64.5% | 35.1% | 0.4% |
The stop came first more often in every BTC and ETH run. That fits the geometry: with a 1:2 setup the stop is half as far from the entry as the target, so on a bar that reaches both, the nearer level is the likelier first touch. "Target first" is not just optimistic: on these bars it was right only 33% to 43% of the time.
The 5-minute data did not settle everything. Some 5-minute candles also spanned both levels, but those were under 0.5% of all trades in every BTC and ETH run. Tick data would settle them; for the rest, 5-minute candles were enough.
The nearest-extreme rule matched the 5-minute answer on 65% to 75% of ambiguous trades in every run with 500 or more of them: 68.0% on 1-hour bars and 65.3% on 4-hour bars at 0.5% / 1% for BTC, 71.5% on 1-hour bars for ETH. Better than a coin, a long way from certain.
How much does the assumption change a backtest?
Here is what the four assumptions do to the same no-edge trades. With a 1:2 setup and no fees, a win rate of 33.3% is breakeven, so the expectancy column shows how much each assumption invents or removes. Expectancy is in R, the average result per trade in units of the amount risked; R-multiples and expectancy has the formula.
BTC, 4-hour bars, stop 0.5%, target 1%, 29,086 trades:
| Assumption on ambiguous bars | Win rate | Expectancy |
|---|---|---|
| Stop first | 27.5% | −0.176R |
| Nearest extreme | 31.5% | −0.055R |
| 5-minute data | 32.4% | −0.029R |
| Target first | 42.3% | +0.267R |
Target-first turns a strategy that loses a little into one that makes a quarter of the risk on every trade. On ETH 4-hour bars with the same levels it showed +0.436R per trade against −0.025R from the 5-minute data. A result like that would pass most people's checks.
Stop-first misses the other way, by 0.147R on BTC. Nearest extreme came closest to the 5-minute answer, off by 0.026R. (In the 5-minute row, the few trades where a single 5-minute candle covered both levels are counted as losses.)
With wider stops the gap closes. At 2% / 4% on 1-hour bars, all four assumptions land within 0.01R of each other on BTC, because only 0.1% of trades are ambiguous.
How does TradingView handle it?
By default, TradingView's strategy tester uses the nearest-extreme rule. Its Pine Script documentation says that when a bar's open is closer to its high than its low, the broker emulator assumes the price moved open → high → low → close.
The Bar Magnifier replaces that guess with lower-timeframe data. The same page says it is available on Premium and Ultimate plans, and the help article notes that a strategy cannot request more than 200,000 lower-timeframe bars, so the earliest trades on a long history may not use it. On a long backtest with the magnifier switched on, check where the magnified range starts.
How does Backcandle resolve it?
The replay engine walks every candle along the same nearest-extreme path: open, then whichever of the high and low is closer, then the other, then the close. When both distances are equal, a bar that closed below its open is walked up first. Orders and position stops and targets fill in the order the path crosses them.
A take-profit fills at its level. A stop-loss is treated as a market order once it triggers and fills 0.05% worse than the stop price, but never outside the bar's range. If a bar opens beyond a level, the order fills at that open, not at the level.
So inside an ambiguous bar the outcome is the model's call, which our test puts at roughly two right answers in three. The way around it is the one that works in any tool: look at a smaller bar.
How do you stop it from flattering your results?
- Count the ambiguous trades. If more than a few percent of your trades resolve on a bar that touched both levels, the result depends on the fill rule as much as on the strategy.
- Score them both ways. Re-run the result with every ambiguous trade as a loss and again as a win. If the edge only exists in the second version, there is no edge.
- Check the stop against the bar size. A stop smaller than the median range of the timeframe you manage the trade on will put a large share of trades in this position. Our 0.5% stop against a 1.38% median 4-hour bar did it to one trade in seven.
- Manage the exit on a lower timeframe. On a 5-minute chart, a stop and target sized for a 1-hour or 4-hour setup are many bars apart, and the question rarely comes up. Backcandle lets you switch timeframe in the middle of a session: plan on the 4-hour chart, switch down to 5-minute bars for the exit, and stay there until the trade is closed.


Fill rules are one of several assumptions that can decide a backtest before the strategy does; how to backtest futures covers the others. For how much data a result needs before any of this matters, see how many trades to backtest.
The script is in our repository, so the test can be repeated on any instrument and timeframe we hold.