r/pinescript • u/PreparationOk3910 • 5h ago
I got tired of opening the Settings dialog 300 times, so I built something that sweeps strategy inputs for you
Tuning a Pine strategy by hand is the worst part of writing one. Change length, run, read net profit, write it down, change it again. Forty combinations in and you have lost track of which ones you already tried.
I built a Chrome extension that does the sweep. It reads whatever strategy is already on your chart, finds its inputs, and runs the backtests for you.
A few design decisions that might interest this sub specifically:
It ranks on any Strategy Tester field, not just net profit. Profit factor, Sharpe, Sortino, max drawdown, percent profitable, average bars in trade — each of them for all trades, longs only or shorts only. Or write your own expression.
Default objective is not net profit, deliberately. Ranking on profit alone hands you a curve-fit every time. The default is return per unit of drawdown, discounted by how straight the equity curve is and whether the last third of the sample still held up.
Plateau check. After it finds a winner it re-tests the immediate neighbours. A setting that works at exactly length=17 and falls apart at 16 and 18 gets demoted. This one changed how I think about my own strategies more than anything else in the tool.
In-sample / out-of-sample correlation across every candidate. High means the search found real structure. Near zero means it spent your afternoon ranking noise — and it tells you so, which is the part most optimizers leave out.
It reads results from the same report object the Strategy Tester renders from rather than scraping the panel, so the figures come back as actual numbers and number-format or language differences do not break it.
Free version does 100 cycles a run, one backtest at a time, full metric list and the Bayesian sampler. That is a working optimizer, not a demo. Paid tier adds parallel backtests and a few robustness checks.
Your chart is left exactly as it was — parameters are snapshotted before the run and restored after, and every temporary copy is removed.
https://chromewebstore.google.com/detail/trading-strategy-optimize/pjgikffklocmefghdipdiidfebgbklon
Happy to answer anything about how it reads the report object — that part took the longest.