Search code examples
pine-scriptalgorithmic-tradingtechnical-indicatorcandlesticks

pinescript for not yet closed candle, not yet closed candle should be invisib


Can you please share the pinescript for tradingview which should hide the current moving candle, I mean the not yet closed candle should be invisible, once closed it should be visible

//@version=4
//Paints an unconfirmed candle gray to remind the trader that the bar can look different by close and reduce mistakes.

study("!", overlay=true)

rt = barstate.isconfirmed

barcolor(rt ? na : color.white, title="Unconfirmed candle")

I tried the above code but it still showing the wick color, i want the whole candle to be invisible. kindly help me


Solution

  • I'm sorry, but there is no function that you can use to color a wick, but you can create your own candlestick chart.

    //@version=5
    
    New_Color = not barstate.isconfirmed ? color.new(color.gray, 0) : close >= 
    open ? color.green : color.red
    plotcandle(open, high, low, close, 'New Candles', New_Color, New_Color, 
    bordercolor = New_Color)
    

    If you want to use a chart with Renko or Line Break, use a security function for the plotcandle function.