Suppose you buy Bitcoin at 60,000 USDT. You set a stop at 58,800 and a profit target at 62,400.
During the next hour, Bitcoin reaches a high of 63,000 and a low of 58,200. Both exit prices fall inside that range.
Your backtest has to decide how the trade ended. Did the price reach your target first, or did it hit your stop before recovering?
An hourly candle cannot answer that question. It records the opening price, the highest and lowest prices, and the closing price. It leaves out the order of the movements between them. Binance’s candlestick documentation describes these summary fields.
That missing sequence can change the result of a trade.
The same candle can contain two different outcomes
Consider this invented one-hour candle. All prices are in USDT per BTC.
| Open | High | Low | Close |
|---|---|---|---|
| 60,000 | 63,000 | 58,200 | 60,600 |
Assume your position was already open and both exit rules were in place before the hour began. The first exit closes the whole position, with no further trades during that hour.
Two possible price paths fit this candle.
In Path A, the price reaches your target of 62,400 after 15 minutes. It falls below your stop later, after the position has closed.
In Path B, the price reaches your stop of 58,800 after 10 minutes. It rises above your target later, after you have exited.
Both paths have the same open, high, low and close. One reaches the target first. The other reaches the stop first.
The closing price of 60,600 does not settle the question. Nor do these two examples tell us how likely either path was.
What that changes in the results
Use a position of 0.01 BTC, bought at 60,000 USDT. Assume a fee of 0.10% on both the purchase and sale, with no slippage. This fee rate is hypothetical.
For this calculation, assume the backtest closes the position at whichever exit price is reached first.
| Assumed first exit | Gross profit or loss | Total fees | Net profit or loss |
|---|---|---|---|
| Target at 62,400 | +24.000 USDT | 1.224 USDT | +22.776 USDT |
| Stop at 58,800 | −12.000 USDT | 1.188 USDT | −13.188 USDT |
For the target exit, the calculation is straightforward: the price gain earns 24 USDT on 0.01 BTC. Subtract the 0.600 USDT entry fee and the 0.624 USDT exit fee to get 22.776 USDT.
Starting with 1,000 USDT, the account would finish with either 1,022.776 or 986.812 USDT, with no BTC remaining.
Those are different results from the same hourly candle. Any backtest that chooses one needs to explain the rule behind that choice.
Choose the rule before you compare strategies
If the available data cannot establish which exit came first, the backtest needs a stated policy. It can leave the trade unresolved or apply an assumption such as “stop first” or “target first.”
Choose that policy before looking at the results. Picking whichever exit improves the return would build hindsight into the test.
Running both assumptions can help you see how much this uncertainty affects the result. Record how many trades were affected and how many trades the test contained in total. Keep unresolved trades visible.
For this fixed trade, the two calculations show what each assumption produces. Across a longer strategy, position sizing and later entries can change the effect. The two results do not guarantee the best and worst outcomes for an entire backtest.
Smaller candles may help
One-minute candles can resolve the sequence if the target is reached in one minute and the stop in a later minute.
But both prices might still fall inside the same one-minute candle.
You can construct the same problem by putting all the movements in our example into the first minute. One path reaches the target after 15 seconds; the other reaches the stop after 10 seconds. If the remaining minutes stay at 60,600, both paths can still produce identical one-minute candles throughout the hour.
Individual trade records can provide more detail. They still need checks for missing records, duplicates and ordering. A timestamp alone may not resolve a tie, and the order in which your system receives messages may differ from the exchange’s order. Binance’s trade-stream documentation distinguishes trade IDs, trade times and event times.
Reaching a price does not guarantee a fill
So far, the calculation has assumed a complete exit at the stop or target price.
Now imagine the next observed price jumps from 60,000 to 57,600. There is no observation at your stop price of 58,800.
A model that assumes an exit at 57,600 would produce a loss of 25.176 USDT after the same fees. That is worse than the earlier stop-price calculation.
The backtest therefore needs separate rules for:
- Which exit condition became true first.
- What price and quantity it assumes were filled.
Spread, available liquidity, latency and partial fills can affect execution. Public trade records cannot establish that a particular order filled. Order-book data can add context, but reconstructing it requires complete updates and does not guarantee an order’s place in the queue. Actual account execution reports provide evidence about filled quantities, prices and commissions. Binance’s order-update documentation describes those reports.
This example uses invented prices and assumed fills. It is not a historical performance result or a demonstration of a SeekAlgo execution feature.
Check when the exit rules became active
The examples above assume the position and exit rules existed before the candle opened. Changing that timing changes which prices count.
If Path A’s exit rules became active only after 30 minutes, the target reached at minute 15 would be irrelevant. The first later exit condition would be the stop at minute 40.
Also check the opening price. If a candle opens beyond the stop, the opening observation already satisfies the stop condition. Filling at the stop price would need its own justification.
Missing data, moving stops, multiple positions and re-entry require more detailed rules than this single-trade example.
Before accepting a backtest result, pick one trade where the candle contains both exit prices. Record when the position opened, when the exit rules became active, which ordering assumption the test used, and how it calculated the fill and costs. Keep that record alongside the result so another person can reproduce the calculation.