A common mistake in Pine Script is executing trades before the candle closes, leading to repainting.
Wrap your entry logic in:
if barstate.isconfirmed
This ensures your script only acts on finalized data, matching your backtest exactly.
What is your biggest challenge when coding strategies?