Your TradingView strategy looks perfect in backtesting — but the moment you go live, it takes extra trades that destroy your results. Why?
There's a hidden bug: when your browser is open, TradingView evaluates your strategy on every intrabar tick instead of at bar close. This creates phantom trades that never appeared in your backtest and can blow up your prop firm account or live trading.
In this video I show you:
Exactly what's happening and why
How to reproduce the bug yourself
The one line of Pine Script code that fixes it (barstate.isconfirmed)
Why this fix doesn't change your backtest results
⏱️ Chapters:
0:00 Your strategy is lying to you
0:43 How TradingView backtesting actually works
2:00 The browser bug that changes everything
2:46 The one-line fix (barstate.isconfirmed)
3:51 Why this doesn't affect your backtest
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🔗 Automated NQ & MNQ Futures Trading Signals:
https://quantlogic.io
🔗 Start your 14-day free trial:
https://quantlogic.io/pricing
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The fix (Pine Script v6):
// Only execute on confirmed/closed bars to prevent phantom signals
canEnterLong = longEntrySignal and strategy.position_size == 0 and allFiltersOk and barstate.isconfirmed
canExitLong = longExitSignal and strategy.position_size = 0 and barstate.isconfirmed
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📧 Contact: [email protected]
#TradingView #PineScript #AlgoTrading #TradingBug #FuturesTrading #PropFirm #QuantLogic #barstate #BacktestVsLive #AlgorithmicTrading