Why does live differ from my backtest?

Costs, the bid and ask, gaps and your broker.

  • Backtests have no costs. No spread, commission, fees, swaps or slippage. Profit is the price difference (E12).
  • Live trades on the bid and the ask. A buy fills on the ask, a sell on the bid, and stops and targets trigger on the side that can actually trade (E3, E5). A backtest has one price.
  • Gaps move fills. When a bar opens beyond a stop, the fill is the open, not the stop price (E8).
  • The broker decides live fills. A live trade exists only once your broker confirms it. Execution speed and liquidity are outside the script.
  • The data may be thinner. data.coverage tells a script how much history it has and whether it is exact.

Past performance does not guarantee future results.

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account