rule backtest — trades, equity curve & drawdown, no look-ahead

Rule backtest — every trade, the equity curve and the drawdown

A trading rule is replayed bar by bar over daily bars. Output: each trade, the equity curve, win rate, average R (average win ÷ average loss), profit factor and maximum drawdown. The rule shown is a 20-day moving-average crossover (long when the close is above its 20-day average, exit when it closes below, 8% stop). Fills happen at the bar close, so there is no look-ahead, replayed on daily history covering 2021-11-29 → 2026-11-30 (1256 daily bars). Results are gross of costs — no commission, spread or slippage is deducted.

AAPL20-day moving-average crossover, long-only, 8% stopprice history · 2021-11-29 → 2026-11-30 (1256 bars)
56
trades
+39.3%
win rate
2.82R
avg R (win/loss)
1.88
profit factor
-22.78%
max drawdown
+77.09%
total return

Measured over 2021-11-29 → 2026-11-30 (1256 daily bars) · one symbol, one rule, 56 trades. A dash marks a figure this sample cannot measure.

Assumptions & limitations
Period
2021-11-29 – 2026-11-30
Out-of-sample from
none — whole period in sample
Trades
56
Costs charged
0 bps per side 0 bps commission + 0 bps slippage, charged on every position change

Hypothetical, backtested results — not the record of a traded account. Past results do not predict future returns; the strategy set was chosen with knowledge of the history it is measured on, and no financing, borrow, tax or capacity constraints are modelled. One name’s result does not generalise. There is no out-of-sample split: every bar behind these figures was already available when the rule was chosen.

Equity curve — the rule's running NAV

03146289411255break-even (1.00×)
strategy NAV (starts 1.00×)x = bar index · 1256 bars · 2021-11-29 → 2026-11-30 · exposure +57%
Sharpe0.72Sortino1.05
Calmar0.53Annualized (extrapolated from 1256 bars)+12.16%
Avg win+6.54%Avg loss-2.32%

Fills at the close of the signal bar (no look-ahead). Profit factor = gross gains ÷ gross losses; average R = average win ÷ average loss; maximum drawdown = deepest peak-to-trough decline of the equity curve. A dash marks a figure this sample cannot measure: with no losing trade there is no profit factor, and with no drawdown there is no Calmar.

The rule under test

sidelong · size 1 · +8% stop
enter whenclose > sma20
exit whenclose < sma20
promotion resultOBSERVE4 of 6 gates passed · total return -66.85% under the 2x downside stress scenario
This rule on AAPL over 2021-11-29 → 2026-11-30 (1256 daily bars) returned +77.09% with a +22.78% worst drawdown and Sharpe 0.72; under a 2x downside shock it returns -66.85%. Verdict: observe.
Below, the agent explains each metric — what it measures, why it matters, and what your number suggests — so you can judge a strategy yourself before risking real money. This is replayed on real daily price history over 2021-11-29 → 2026-11-30 (1256 daily bars), gross of trading costs — your decisions, your risk.
What a backtest actually proves (and does not)
We replayed your rule bar-by-bar over AAPL over 2021-11-29 → 2026-11-30 (1256 daily bars) and it made a total return of +77.09% across 56 trade(s).
A backtest replays your exact entry/exit rules over historical bars to see how they WOULD have done. It is a sanity check, not a promise: the future is not the past, and a rule that fits old data can fail live. That is why we also stress it and slice it by market regime before trusting it. It is also gross of costs — no commission, spread or slippage is deducted.
→ It was profitable in this sample — keep validating.
Risk-adjusted return — Sharpe, Sortino, Calmar
Sharpe 0.72, Sortino 1.05, Calmar 0.53.
Return alone is misleading — a strategy that doubles then halves is not "good." Sharpe divides return by total volatility (reward per unit of wiggle). Sortino is the same but only penalises DOWNSIDE wiggle (you do not mind upside surprises). Calmar divides annual return by the worst peak-to-trough drop. Higher is better; Sharpe ≥ 1 is the usual "worth a look" line.
→ Risk-adjusted return is below the usual bar — returns came with a lot of volatility.
The worst it got — max drawdown
The deepest peak-to-trough fall was +22.78%.
Max drawdown is the largest drop from a high-water mark to a later low. It is the question "how much pain would I have had to sit through?" — the number that actually makes people abandon a strategy at the worst moment. A high Sharpe with a 60% drawdown is usually un-tradeable in real life.
→ Drawdown was tolerable (≤ 25%).
Edge quality — hit-rate & profit factor
Hit-rate +39.29%, profit factor 1.88 (avg win +6.54% vs avg loss -2.32%).
Hit-rate is the share of trades that won. But winning often is not the same as making money — profit factor (gross profit ÷ gross loss) tells you whether your winners outweigh your losers. A 40% hit-rate with big wins and small losses beats a 70% hit-rate that gives it all back. Profit factor > 1 means the edge is net positive.
→ Winners comfortably outweigh losers.
Stress test — what 2x downside does
Under a 2x downside shock the same rule returns -66.85% (vs +77.09% unshocked).
We amplify every down-bar move and re-run the rule. It answers "if the bad days were twice as bad, does this strategy still survive?" A rule that only works in calm markets is a trap. Promotion sim→live requires surviving the shock, not just the base case.
→ Falls apart under stress — do not promote.
Promotion verdict: OBSERVE
Cleared 4/6 gates (score 0.67).
Sim-to-live promotion is the whole point: only rules that pass return, risk, drawdown, profit-factor, stress and across-regime checks get handed to the model foundry as a candidate. "Promote" = ship to live paper/real; "observe" = keep collecting data; "reject" = back to the drawing board.
→ Promising but not proven — keep it in sim.

Backtest glossary

Backtest
Replaying a fixed set of trading rules over historical prices to estimate how they would have performed.
Sharpe ratio
Annualised return divided by the volatility of returns — reward per unit of total risk.
Sortino ratio
Like Sharpe but only counts downside volatility in the denominator.
Calmar ratio
Annualised return divided by the maximum drawdown — reward per unit of worst-case pain.
Max drawdown
The largest drop from a peak in the equity curve to a subsequent trough.
Profit factor
Gross profit divided by gross loss; above 1 means the strategy is net profitable.
Exposure
The fraction of bars the strategy was actually in a position (capital at work).
Stress test
Re-running the strategy on a deliberately worse price path to see if it survives bad conditions.
Sim-to-live promotion
The gate that decides whether a paper-traded rule-set is trustworthy enough to run with real consequences.

Trade ledger — 56 trades

119 @ 180.3326 @ 174.927 bars-3.00%rule
242 @ 170.3352 @ 168.6410 bars-0.99%rule
353 @ 168.8856 @ 168.883 bars+0.00%rule
476 @ 163.9892 @ 165.7516 bars+1.08%rule
5108 @ 166.02109 @ 156.771 bars-5.57%rule
6125 @ 149.64129 @ 145.384 bars-2.85%rule
7130 @ 146.14133 @ 142.643 bars-2.39%rule
8143 @ 141.66145 @ 137.442 bars-2.98%rule
9148 @ 138.93187 @ 163.6239 bars+17.77%rule
10226 @ 147.27234 @ 145.038 bars-1.52%rule
11240 @ 146.87251 @ 144.2211 bars-1.80%rule
12253 @ 148.03257 @ 142.914 bars-3.46%rule
13281 @ 133.49308 @ 148.4827 bars+11.23%rule
14316 @ 151.03321 @ 148.505 bars-1.68%rule
15322 @ 150.47343 @ 160.1021 bars+6.40%rule
16344 @ 165.56352 @ 163.778 bars-1.08%rule
17354 @ 168.41420 @ 192.5866 bars+14.35%rule
18439 @ 184.12445 @ 177.566 bars-3.56%rule
19465 @ 174.91475 @ 175.4610 bars+0.31%rule
20485 @ 177.57520 @ 193.6035 bars+9.03%rule
21536 @ 188.63545 @ 184.409 bars-2.24%rule
22549 @ 189.30551 @ 188.322 bars-0.52%rule
23578 @ 176.08580 @ 171.372 bars-2.67%rule
24584 @ 173.31585 @ 171.481 bars-1.06%rule
25594 @ 175.04597 @ 169.383 bars-3.23%rule
26604 @ 169.89605 @ 169.301 bars-0.35%rule
27606 @ 173.50608 @ 169.302 bars-2.42%rule
28609 @ 173.03665 @ 218.5456 bars+26.30%rule
29679 @ 221.27694 @ 220.8515 bars-0.19%rule
30705 @ 228.87717 @ 221.6912 bars-3.14%rule
31718 @ 225.77734 @ 230.1016 bars+1.92%rule
32747 @ 228.02777 @ 243.8530 bars+6.94%rule
33793 @ 238.26797 @ 228.014 bars-4.30%rule
34800 @ 233.22801 @ 227.631 bars-2.40%rule
35803 @ 232.62814 @ 237.3011 bars+2.01%rule
36815 @ 241.84816 @ 238.031 bars-1.58%rule
37836 @ 222.13839 @ 204.363 bars-8.00%stop
38852 @ 204.60860 @ 198.898 bars-2.79%rule
39865 @ 210.79871 @ 206.866 bars-1.86%rule
40892 @ 201.00918 @ 211.2726 bars+5.11%rule
41924 @ 213.25948 @ 226.7924 bars+6.35%rule
42950 @ 234.07970 @ 245.2720 bars+4.78%rule
43976 @ 262.24996 @ 267.4620 bars+1.99%rule
441000 @ 271.491015 @ 274.1115 bars+0.97%rule
451045 @ 258.281055 @ 261.7310 bars+1.34%rule
461057 @ 263.881059 @ 260.582 bars-1.25%rule
471061 @ 266.181065 @ 264.184 bars-0.75%rule
481088 @ 255.631134 @ 301.5446 bars+17.96%rule
491151 @ 308.631171 @ 308.9120 bars+0.09%rule
501184 @ 316.831185 @ 311.301 bars-1.75%rule
511189 @ 313.451212 @ 329.4023 bars+5.09%rule
521213 @ 333.021214 @ 330.321 bars-0.81%rule
531215 @ 333.691236 @ 338.3221 bars+1.39%rule
541238 @ 349.511240 @ 342.372 bars-2.04%rule
551241 @ 350.691250 @ 342.569 bars-2.32%rule
561251 @ 349.081255 @ 354.004 bars+1.41%eod

Exit reasons: rule = the exit predicate fired; stop = the protective stop was hit; target = the take-profit was hit; eod = closed at the last bar. Bar index = position in the price path, not a calendar date.