Find out if a strategy works before it costs you.
A backtest is only worth trusting if it can disappoint you. We build them to include the costs most people leave out, to hold back years the strategy never sees while it's tuned, and to report the drawdowns as loudly as the returns. What it did, honestly, not what we wish it did.
The strategy, in real code.
No black box. The rules are a small, readable file: a breakout window, an ATR stop, a target, and a size that's a share of equity. You can read exactly what it does before a dollar is tested.
1# es_breakout.py — an ES breakout, backtested with costs baked in2from burneh.backtest import Strategy, crossover34class EsBreakout(Strategy):5 lookback = 20 # breakout window6 atr_period = 147 risk_atr = 2.0 # stop at 2·ATR, target at 3·ATR89 def on_bar(self, bar):10 upper = self.highest(self.high, self.lookback)[-2]11 atr = self.atr(self.atr_period)1213 # act only on a closed bar, so the test matches live14 if self.flat and crossover(bar.close, upper):15 stop = bar.close - self.risk_atr * atr16 target = bar.close + 3.0 * atr17 self.buy(size=self.pct_equity(0.10), stop=stop, target=target)Run it with the costs in.
Every fill pays real commission and a tick of slippage, assumed against you. It's tuned on 2019–2022 and then checked on years it never saw. A backtest without that is fiction.
The result, in full.
Not a single number to trust or ignore. The whole run: the equity curve with its drawdown, the stats, and every trade. Flip to gross and watch the costs come back.
A backtest is a rear-view mirror. It tells you where the road went, not where it turns next.
Done well, it earns real confidence about a few specific things: whether the logic had an edge on real history after costs, how deep the drawdowns got, and whether it survives on data it was never tuned on. What it can't promise is that next year looks like the last five. Past performance is not a prediction, and we'll never sell it to you as one.
Find out if a strategy works before it costs you.
The strategy in plain code, run with real costs against years it never saw, and the whole result reported, drawdowns as loudly as returns.