Spot the Overfit in a Parameter Table
Posted: Sun Oct 25, 2026 8:07 am
Spot the Overfit in a Parameter Table
A trader tests a moving average period on a strategy and reports net results in R over 200 trades for each setting. Period 8: plus 4. Period 9: minus 6. Period 10: plus 2. Period 11: plus 48. Period 12: minus 5. Period 13: plus 1. Period 14: minus 3.
Which one looks best? Period 11, with plus 48R. The trader wants to adopt it.
Look at the neighbors. Period 10 gives plus 2, and period 12 gives minus 5. A change of one unit in either direction collapses the result from plus 48 to roughly breakeven or a loss. The overall pattern jumps around between negative and slightly positive values, with one spike.
That is the signature of noise. A robust idea shows a plateau: periods 9 through 13 would all be in a similar range, and the exact choice would matter little. A single peak surrounded by mediocre values is likely the result of fitting.
What to do? Do not use period 11. Consider whether the strategy has an edge at all, since the median result across settings is close to zero. If you want to continue, test on out-of-sample data with a fixed setting chosen before seeing results.
Compute the average: 4 minus 6 plus 2 plus 48 minus 5 plus 1 minus 3 is 41, divided by 7, about 5.9R, but without the spike it is minus 1.2R on the other six.
Takeaway for your own testing: always print the full table, never just the best row.
Exercise: look at your last optimization and check how many neighbors of your chosen setting are profitable.
A trader tests a moving average period on a strategy and reports net results in R over 200 trades for each setting. Period 8: plus 4. Period 9: minus 6. Period 10: plus 2. Period 11: plus 48. Period 12: minus 5. Period 13: plus 1. Period 14: minus 3.
Which one looks best? Period 11, with plus 48R. The trader wants to adopt it.
Look at the neighbors. Period 10 gives plus 2, and period 12 gives minus 5. A change of one unit in either direction collapses the result from plus 48 to roughly breakeven or a loss. The overall pattern jumps around between negative and slightly positive values, with one spike.
That is the signature of noise. A robust idea shows a plateau: periods 9 through 13 would all be in a similar range, and the exact choice would matter little. A single peak surrounded by mediocre values is likely the result of fitting.
What to do? Do not use period 11. Consider whether the strategy has an edge at all, since the median result across settings is close to zero. If you want to continue, test on out-of-sample data with a fixed setting chosen before seeing results.
Compute the average: 4 minus 6 plus 2 plus 48 minus 5 plus 1 minus 3 is 41, divided by 7, about 5.9R, but without the spike it is minus 1.2R on the other six.
Takeaway for your own testing: always print the full table, never just the best row.
Exercise: look at your last optimization and check how many neighbors of your chosen setting are profitable.