So you’ve been trading for a while and always wanted to automate your trading or build an algo


Now with ai, you feel like its time to give it a shot. You see all this stuff on twitter about how easy it is to build a profitable trading bot
You go to claude and have it write you up a pinescript strategy for tradingview
Claude builds 5+ knobs (parameters) within the strategy and each time you go adjust one, the result completely change
You realize there’s hundreds or thousands of ways you can combine different values of these knobs
Your initial thought is, “Alright, let’s keep testing different knobs and let’s move the knobs until the “Total P&L” label shows the highest value…”
Little do you realize you just fell for the most lethal back testing trap. Selection bias.
Imagine you flip a coin 20 times. You do this 1000 times. Each sequence is a different “knob setting.” By pure chance, one of those 1000 sequences will show 17 heads out of 20, an 85% hit rate. It looks incredible right?
But the coin is fair. It’s 50/50. That sequence was lucky, not skilled
If you pick that sequence and bet on heads going forward, you’ll get 50%. The edge you thought you had vanishes because it was never real. It was the best result out of 1,000 random trials
This is the trap with any backtester that lets you tune knobs without accounting for how many combinations you tried
The more knobs you turn, the more likely you find something that looks amazing but is actually just noise. The strategy you deploy will perform nothing like the backtest because it was never a real edge. It was the best coin flip out of a thousand
There are ways to correct for this. Research them if you're going to go down this path. I've seen too many times someone send me this amazing looking screenshot of the tradingview backtester
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • Comment
  • Repost
  • Share
Comment
Add a comment
Add a comment
No comments
  • Pinned