Cross-post. Original: stellarbytecapital.com/blog/genetic-algorithm-trading-strategy
A genetic algorithm is a wonderful way to find a trading strategy that made money in the past and will never make money again. Point it at a backtest, let it breed for a few hundred generations, and it will hand you a gorgeous equity curve built entirely out of noise. The technique isn't the problem — the way most people wire it up is. Done with discipline, a genetic algorithm (GA) is one of the best tools for optimizing a real edge. Done naively, it's the fastest overfitting machine ever invented.
Why a GA at all
A trading strategy usually has a handful of parameters: lookback windows, entry/exit thresholds, sizing, stops. The search space is large, bumpy, and non-differentiable — you can't take a clean gradient through a backtest. Grid search explodes; hand-tuning is slow and biased.
A GA fits this shape: each candidate strategy is an individual, scored by a fitness function, with strong ones kept and bred via crossover (mix two parents' parameters) and mutation (perturb a value). Over generations the population drifts toward high-fitness regions — no gradient required.







