1-second vs 1-minute backtesting
A backtest on bars only knows each bar’s open, high, low and close, so when one bar touches both your stop and your target it has to guess which came first, and it can’t see the price you really got when the stop was hit. In our simulation of trades with a 0.1% stop and a 0.2% target, a daily bar left 59% of exits unclear, and an engine that guessed “target first” showed +1.19R per trade where the true result was +0.03R. Second-by-second fills remove the guess, because each exit is booked at the second and the price it would have happened live.
The same-bar problem
Say you buy at 100.20 with a stop at 99.50 and a target at 101.50. If the next bar’s low is below 99.50 and its high is above 101.50, the bar tells you both levels traded, but not in which order. Was it a 1.3-point win or a 0.7-point loss? The bar can’t say. Every bar-based engine has to pick a rule, and the rule it picks changes your results.
The shorter the bar, the less often this happens, because a short bar rarely covers the distance between stop and target. But shorter bars don’t fix the second problem: the price you actually get.
A worked trade: one day, three answers
Here is one synthetic day we built for illustration: entry 100.20, stop 99.50, target 101.50, 100 shares.
- Daily bar: the bar contains both levels. An engine that books the target first shows +$130.
- 1-minute bars: they show the stop was hit first, in the 10:02 bar. But they don’t show the gap inside that minute, so the engine fills the stop at 99.50: −$70.
- Second by second: the price jumped through the stop at 10:02:17 and the first price that traded was 99.18, 0.32 below the stop: −$102.
Three engines, three results for one trade: a profit, a loss, and a loss 46% bigger. Over hundreds of trades these differences add up to a different strategy.
How bar-based engines guess
When a bar contains both levels, engines generally use one of these rules:
- Optimistic: assume the target was hit first. It flatters every strategy with tight stops.
- Pessimistic: assume the stop was hit first. Safer, but it punishes strategies that really did reach their targets.
- A path rule: assume the price went open → high → low → close (or open → low → high → close on a down bar). It is a coin flip dressed up as logic.
- Look inside the bar: use smaller bars or ticks for the bars where it matters. This is the right idea, and it is only as good as the finer data.
Stops are filled at the stop price in most bar engines, even when the market gapped through it. That is the fill-price problem, and it doesn’t go away with any of the four rules.
How often it happens: our simulation
We simulated a market that moves second by second with no trend (a random walk with a typical move of 0.05% a minute), opened 4,000 trades at random moments with the stop and target below, and followed each one second by second to see which level it really hit first. Then we looked at the bar that contained the exit, at five bar sizes, and counted how often that bar touched both levels.
Stop 0.1%, target 0.2%
| Bars the backtest sees | Exits where one bar hit both stop and target | Average trade if the engine guesses target first | If it guesses stop first | Second by second (truth) |
|---|---|---|---|---|
| 1-minute | 0.0% | +0.03R | +0.03R | +0.03R |
| 5-minute | 0.1% | +0.03R | +0.03R | +0.03R |
| 15-minute | 3.3% | +0.09R | −0.01R | +0.03R |
| 1-hour | 21.5% | +0.45R | −0.19R | +0.03R |
| Daily (6.5-hour session) | 58.6% | +1.19R | −0.57R | +0.03R |
Stop 0.25%, target 0.5%
| Bars the backtest sees | Exits where one bar hit both stop and target | Average trade if the engine guesses target first | If it guesses stop first | Second by second (truth) |
|---|---|---|---|---|
| 1-minute | 0.0% | +0.01R | +0.01R | +0.01R |
| 5-minute | 0.0% | +0.01R | +0.01R | +0.01R |
| 15-minute | 0.0% | +0.01R | +0.01R | +0.01R |
| 1-hour | 1.1% | +0.03R | +0.00R | +0.01R |
| Daily (6.5-hour session) | 24.5% | +0.50R | −0.24R | +0.01R |
On this market the true average trade is close to zero, as it should be with no trend. On 1-minute bars the exit bar almost never touched both levels (0.0%), but on hourly bars it did for 21.5% of trades with the tighter stop, and an optimistic engine on daily bars turned a strategy with no edge into one that made +1.19R a trade. Real markets have news spikes and fast gaps that this smooth model doesn’t, so the real numbers for short bars are higher than shown here.
The fill price problem: gaps through the stop
A stop order becomes a market order when its price trades. In a fast market the next price can be well beyond the stop, as in the worked trade, where the fill was 0.32 below. A bar engine that fills at the stop price books a smaller loss than you would have taken. For strategies with small stops, this slippage can be a large share of every loss, and it is invisible on minute bars because the bar’s low hides the order in which prices traded.
The fix is to fill at the first price that actually traded at or beyond the stop, at the second it traded, and to add your commission and an allowance for slippage on top.
What changes with second-by-second fills
- The order of stop and target is known for every exit, so there is no optimistic or pessimistic guess.
- Stops fill at the first price that traded at or through them, so gaps and spikes cost what they would have cost.
- Prop rules checked on equity, such as daily loss and intraday trailing drawdown, see the real lowest and highest equity of the day.
- Short-term strategies (scalping, opening-range breakouts, tight trailing stops) stop looking better on paper than they trade.
Matana Labs (our product) fills every backtest second by second on every plan, on up to 23 years of history; the bars you see on the chart depend on the plan. It is not the only tool with second-level data, so check what each one uses for fills, not just for charts.
When minute bars are enough
Our own numbers show that 1-minute bars rarely hit the same-bar problem when stops are a few tenths of a percent away. Minute bars are usually fine when:
- stops and targets are far apart compared with a typical 1-minute range;
- trades last hours or days, and entries and exits happen at the close of a bar;
- you add realistic slippage to every stop, because the fill price problem is still there.
They are not enough for tight stops, fast markets, strategies that trade around news or the open, or rules that depend on intraday equity, like most prop-firm limits.
Tick data, second data and minute data
Tick data records every trade or quote. Second data summarises each second: its open, high, low, close and volume. Minute data does the same per minute. For deciding which of two levels traded first and at what price, second data answers almost every case that minute data can’t; ticks matter mainly when many prices trade within the same second, as in very fast markets or very large orders.
Keep reading
Questions
Is 1-minute data good enough for backtesting?
Often, if your stops and targets are wide compared with a typical 1-minute range and you add realistic slippage. It is not enough for tight stops, fast markets or rules that depend on intraday equity, because a minute bar hides the order of prices and the real fill after a gap.
What happens when the stop and target are hit in the same bar?
The backtest has to guess. Optimistic engines book the target, pessimistic ones the stop, others assume a path through the bar. In our simulation, an optimistic engine on daily bars made a strategy with no edge show +1.19R per trade.
What is intrabar backtesting?
Using data finer than the bar, such as seconds or ticks, to decide what happened inside a bar: which level was hit first and at what price. It removes the same-bar guess.
Do I need tick data to backtest?
For most strategies, second-level fills answer the same-bar question and the gap-fill question. Tick data matters mostly for very fast strategies where many prices trade inside the same second.
Does Matana Labs use second data for every plan?
Every backtest in Matana Labs fills trades second by second, on every plan. The chart bars depend on the plan, from 10-minute bars on the free plan to 1-second bars on Quant.