You test an EMA crossover: average. You try 9/21, 12/26, 20/50, add an RSI filter, change the timeframe… and finally one version shows a beautiful equity curve. That's when the danger is greatest.
WHAT THE RESEARCH SAYS
Bailey, Borwein, López de Prado and Zhu (2014) showed that the more variations of a strategy you test, the more likely it is that the best-looking one owes its result to luck. With only about 20 variations, one will usually look statistically significant even if none has a real edge. Their conclusion: a backtest that doesn't say how many versions were tried can't be trusted.
Campbell Harvey and Yan Liu (2015) proposed "haircuts" for backtested results to account for this. The cut isn't the same for everyone: weak-looking results need to be cut by more than half, while very strong results lose less.
THE WARNING SIGNS
Too many rules for too few trades. Parameters that look oddly specific (EMA 17 and 43). Results that collapse when a parameter changes slightly. A strategy that only works on one coin or one period.
IN PRACTICE
1. Count and write down how many versions you tested. The more there are, the more sceptical you should be about the best one.
2. Keep part of the data untouched. Test the final version on it only once, at the end.
3. Prefer simple rules that still work when the parameters change a little (for example EMA 20 or 25 instead of exactly 21).
In one sentence: if you torture the data long enough, it will confess to anything — test less, test honestly.