7 days Pro+ free · no cardStart my free trial

Backtest bias: validate a trading strategy without hindsight · 1 / 5

Find when a pivot signal actually became available

A marker drawn on a turning point does not prove you could have traded there. Reconstruct what the rule knew at each bar close before assigning an entry price.

Athenum7 minUpdated:

Pivot low rule: candidate time vs available-at time

For this original exercise, a strict pivot low must be lower than the lows of two preceding and two following completed five-minute bars. Equal lows do not qualify. Evaluate only at bar close. The two preceding lows are 103 and 102; the candidate bar makes a low of 100. At that point it is only a candidate: neither following bar is known.

A chart may place its label on the candidate after later bars confirm the condition. Store candidate time and available-at time separately. An indicator that updates during an unfinished candle is not automatically defective, but a replay must reproduce the information its actual decision rule used. Do not replace live knowledge with a final cleaned chart.

Confirmation vs execution: fill price and failed candidates

Even after confirmation, an order needs submission and a fill. Record those timestamps independently. A rule evaluated after the 10:15 close cannot assume an earlier intrabar low as its entry, and it cannot guarantee execution at the closing price either. Latency, spread and a gap can change the executable price.

Replay rejected candidates as well as confirmed ones. If the second following bar makes a new low below 100, the candidate fails. Keeping only the historical markers that survived makes it impossible to audit what a trader saw while the setup was forming.

Example: 0.81R after confirmation vs 16R in hindsight

The candidate occupies 10:00–10:05 UTC. The following bars have lows 101 and 102, so confirmation occurs at 10:15. Assume the next executable purchase is 104.20, a fixed stop is 99.50 and a later hypothetical exit is 108. One unit risks 4.70 and earns 3.80: 3.80 / 4.70 = 0.8085R before costs. Prices are USDT per underlying unit with a linear payoff. R measures the planned entry-to-stop distance before costs, not the maximum possible loss.

Assigning a fictitious entry at 100 instead gives risk 0.50 and profit 8, or 16R. Both divisions are mathematically correct; only the first entry respects this signal's availability. Neither calculation predicts that the exit at 108 will occur.

Hypothetical five-minute replay, all times UTC
IntervalLowState at close
10:00–10:05100Candidate; two future bars unknown
10:05–10:10101One qualifying following bar
10:10–10:15102Confirmed at 10:15
10:15–10:20103After initial confirmation
Keep the marker's bar, knowledge timestamp and execution record separate.Open full-size diagram
  1. Candidate low
  2. Following bars close
  3. Signal confirmed
  4. Order submitted
  5. Fill recorded
Keep the marker's bar, knowledge timestamp and execution record separate.
Keep the marker's bar, knowledge timestamp and execution record separate.

Hypothetical five-minute replay, all times UTC. Keep the marker's bar, knowledge timestamp and execution record separate.

Dots show interval lows, not their exact occurrence times or a continuous price path. The arrow spans the two following bars, from 10:05 to 10:15. Formulas below compare assumed entries, not observed fills.

Low: 100 → 101 → 102 → 103. Confirmed at 10:15.

Look-ahead bias: entering at a backdated pivot marker

If the 10:10–10:15 bar instead falls to 99.80, the original candidate fails. A backtest cannot keep the earlier 100 entry while discarding the failed confirmation. Write tie rules and confirmation delays before seeing outcomes.

Before acting

  • Freeze pivot and tie rules.
  • Store candidate and available-at timestamps.
  • Separate confirmation, submission and fill.
  • Replay rejected candidates.
  • Recalculate risk from the executable entry.

Check your understanding

Under the same completed-bar rule, require three following bars instead of two. The third low is 103. When is the original candidate confirmed?

Show the explained answer

At 10:20 UTC, when the third following bar closes. The low 103 satisfies the strict comparison with 100, but its completed value was not available at 10:15. The entry must follow the new confirmation time.

Sources and further reading

Continue with Athenum

Related lessons

Related courses