Tradingview doesn't provide a way to prevent unclosed candles from displaying in real time. This script helps to reduce errors that span from reading unconfirmed candles by preventing the unconfirmed candle from displaying across all timeframes. Ideal for traders with strategies that rely on candle confirmation signals.
NOTE: It works by drawing new candles based on the normal candles and stops just before the current unconfirmed candle, so you need to disable regular bar chart candles for this to work properly. How to do that -