Common Pine Script backtest pitfalls
Pine Script is powerful but easy to misuse. Default settings, repainting indicators, and ignored fees are the most common ways a backtest oversells a strategy.
Repainting indicators
Indicators that change their past values as new bars arrive make a backtest look better than live trading. Confirm your signals are calculated only from confirmed bars.
Ignoring fees and slippage
Pine backtests often run with no commissions, spread, or slippage. Add realistic costs or the edge disappears on the first live trade.
Default data and look-ahead
Using default bars or referencing future values leaks information into the test. Verify the signal uses only data available at the bar close.