Search code examples
plotbackgroundpine-scriptpine-script-v5candlesticks

Code for background plot between candles and Ma


I wonder if someone has a piece of pinescript code that plot the Background between the candles and the (pink) 200 SlowMa.

enter image description here

I was looking to do a background plot as the attached picture is showing.

But, cannot find something like that atm, I tried to do that from de Tradingview documents but no luck till now :( could kindly someone point me out on any help on this, it will be great and I will be grateful so much!

Trying to code a plot the Background between the candles and the (pink) 200 SlowMa.


Solution

  • ma = ta.sma(close, 200)
    close_plot = plot(close, color= color.new(color.white,100))
    ma_plot = plot(ma, linewidth = 2)
    fill(close_plot, ma_plot, color = (close > ma ? color.blue : color.gray))