How it works
A genetic algorithm searches a space far too large to test exhaustively, then every strategy it finds has to prove itself on data it has never seen.
Beating the curse of dimensionality
A trading strategy that combines several indicators has many settings to tune. Strategy Builder uses six indicators (Stochastic, SMA, EMA, ATR, RSI and MACD), plus an end-of-month effect. Each indicator can be turned on, turned off or reversed, and each has its own windows and thresholds, for 17 settings in all. That’s the curse of dimensionality: with the default ranges, the whole-number settings alone allow about 80 trillion combinations. At a thousand backtests a second, a grid search would take more than 2,500 years, and a random search would sample almost none of the space. Strategy Builder uses a genetic algorithm instead. A population of strategies competes on the measures you choose, such as Sharpe ratio, Calmar ratio, yearly return or drawdown. The best strategies breed and mutate, and each generation improves on the last. A typical run finds strong strategies after testing about 20,000 candidates, in minutes rather than millennia.
Tested on data it has never seen
A strategy that only looks good on the data it was trained on is worthless. So Strategy Builder holds back recent data that training never sees, then tests each strategy on that holdout period. A t-test checks whether its holdout returns differ significantly from its training returns. Strategies that fail are left out. An optional penalty on trading frequency steers the search away from strategies that trade too often to be real.
From strategies to a portfolio
From there, Strategy Builder builds a portfolio. You can pick the best tickers automatically, then set the balance between minimum risk and maximum return. You can also give each asset class (stocks, bonds, gold, commodities and more) its own share of the portfolio. Each day it checks every holding for a signal change, emails you when one occurs, and works out the number of shares to trade. A weekly report compares your portfolio with the S&P 500. You can export any strategy as a TradingView Pine Script and chart it there.