Backtest
The Backtest runs your script — the actual Pine, not a re-implementation of it — across our bars, and reports what it would have done after costs. It is built to disappoint you honestly rather than flatter you: fills are pessimistic, costs are charged on both sides, and a third of the history is kept out of the fit.
The fill rules
Every assumption here is deliberately the unkind one. A backtest that assumes it can fill at the price that triggered it is describing a market that does not exist.
| Rule | What it does | Why it is the unkind choice |
|---|---|---|
| Fills | The next bar's open | You cannot trade a bar you have not finished watching. |
| Signals | Confirmed bars only | Nothing intrabar, and nothing that can repaint into a better entry. |
| Costs | 5 bps commission, 2.5 bps slippage, per side | Charged on the entry AND the exit, including the final open trade when the history runs out. |
| Benchmark | Buy-and-hold, same entry cost | A cost-free benchmark makes every script look better than it is. |
| Sizing | 100% of equity, one position | No leverage and no pyramiding, so the curve is the signal rather than the sizing. |
Reading the strip
Six numbers sit above the equity curve. Net return is the least interesting of them.
| Number | What it is | How to read it |
|---|---|---|
| Net return | After costs, dollars beneath | On its own it says almost nothing — a long-only script in a bull market makes money by accident. |
| vs buy & hold | The same money, left alone | The number that matters. A +80% that trails a +392% buy-and-hold is a losing script. |
| Max drawdown | Peak to trough | Decides whether you could actually have held it. Most people cannot hold what they backtest. |
| Win rate | Wins over trades | A high rate with poor returns means the losers are large. |
| Profit factor | Gross win ÷ gross loss | Below 1 the script loses money by construction, whatever the win rate says. |
| Sharpe | Return per unit of volatility | Annualised, with the average holding period beside it. |
Held out
The tester keeps two periods and writes both out with their start, end and length: in sample, the part you tune on, and out of sample, the part no tuning touched. Out of sample is the last stretch of the period: the setup offers the lengths the period allows (3M, 6M, 1Y and 2Y on three years of daily bars, each leaving at least 30 bars on both sides), the one nearest a third is the default, or you start it at any date. Wherever the result appears the two periods are marked: a bar over each on the chart with the out-of-sample bars shaded, the same shade on the equity curve, and one line per period in the results with its dates, length, bars, trades, net and Sharpe. The out-of-sample line ends in one word: survived, decayed, or did not survive. A result that works in sample and dies out of sample is the single most common way a strategy lies to you, and it is worth more than every other number on the page.
When to believe it
Twenty trades a year is the floor for drawing any conclusion at all. Under that the page says so in place of a verdict, because with eighteen trades over three years the numbers are noise wearing a suit. One symbol and one price history is a reason to test a script elsewhere, not evidence of an edge — and the universe is today's index members, so names that dropped out are missing and the sample flatters.
When the numbers do hold up, the Optimiser is the next question: whether the settings did anything, or whether the best of many tries just got lucky.