burneh
Trading

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.

es_breakout.pypython
1# es_breakout.py — an ES breakout, backtested with costs baked in
2from burneh.backtest import Strategy, crossover
3
4class EsBreakout(Strategy):
5 lookback = 20 # breakout window
6 atr_period = 14
7 risk_atr = 2.0 # stop at 2·ATR, target at 3·ATR
8
9 def on_bar(self, bar):
10 upper = self.highest(self.high, self.lookback)[-2]
11 atr = self.atr(self.atr_period)
12
13 # act only on a closed bar, so the test matches live
14 if self.flat and crossover(bar.close, upper):
15 stop = bar.close - self.risk_atr * atr
16 target = bar.close + 3.0 * atr
17 self.buy(size=self.pct_equity(0.10), stop=stop, target=target)
backtest · runrunning
$python backtest.py es_breakout --data ES_5m_2019_2024.csv

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.

ES Breakout · report
5m · 2019–2024 · out-of-sample held back
net return
+58.0%
max drawdown
−18.4%
sharpe
1.24
win rate
47%
trades
214
equity · account balance+58.0%
datesideentryexitp&l
2024-11-14long5,842.255,918.00+1.30%
2024-11-08long5,760.505,731.75-0.50%
2024-10-29short5,905.005,847.25+0.98%
2024-10-21long5,688.755,742.50+0.95%
2024-10-15long5,701.005,690.25-0.19%
2024-10-03short5,880.505,861.00+0.33%

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.