GUIDE · QUANT

Optimiser

Fit on the past, judge on the slice it never saw. The Optimiser runs your script across a grid of input values and finds the best one — and then does the part almost nobody does, which is tell you whether that best was worth anything or whether trying enough combinations would have produced it from nothing.

Setting up a sweep

The sweep needs numeric inputs to sweep. A script with none says so and the run button stays down. For each input you set a range and a step; the page shows how many combinations that makes before it spends anything, because the count is the thing that decides how much you should trust the answer.

Pick what you are optimising for: Sharpe, Sortino, profit factor, net return, or return ÷ drawdown. It matters more than it looks — net return will happily pick the setting that took the most risk, and return ÷ drawdown will not.

The noise floor

If none of your settings did anything at all, what would the best of them score anyway? That is the question. Search enough combinations and one of them will look excellent for the same reason that the best of a thousand coin-flippers looks like a genius.

So the page computes it. For a sweep of N combinations with the spread your own results show, it works out the score the best of N random tries reaches half the time, nine times in ten, and ninety-nine times in a hundred. The nine-in-ten number is the floor your winner has to clear. Beating it by a hair is not a result; the heading says so.

This is the closed form of the sampling procedure, not a literal ten-thousand-run loop — the same distribution, without the sampling error and without re-running your Pine script ten thousand times in your browser.

Reading the verdict

HeadingWhat it meansWhat to do
Clears the noise floorThe winner beat the nine-in-ten floor by a real margin.Take the settings to walk-forward, then to the held-out third.
Clears the noise floor, thinlyIt cleared, but by little.Treat it as a hint, not a result. Widen the history before leaning on it.
Does not clear the noise floorThe best combination scored no better than luck would across that many tries.The sweep found nothing. Change the idea, not the numbers.
Too little data to judgeUnder twenty trades a year.No verdict is offered. Get more history or a script that trades more.

Every heading, colour, printed number and mark on the page reads from one calculation. The page cannot tell you it won at the top and lost at the bottom.

Walk-forward

Turn it on and the history is cut into folds: the inputs are fitted on each fold's in-sample stretch and then scored on the stretch immediately after, which the fit never saw. What you want is boring — settings that stay roughly the same fold to fold, and out-of-sample scores that resemble the in-sample ones. Settings that leap around between folds are curve-fitting, however good the headline number looks.

Whatever survives here still has to survive the Backtest's held-out third and its costs. Optimising is how you find a candidate, not how you prove one.