I only know that I can use overlay = true when I'm first plotting but what if I want to add another indicator in the same script that needs overlay to be false. Is there a way I can do that?
I added 26 SMA with 9 EMA perfectly fine and I'm trying to see whether I can also add a stochastic oscillator in the script but unlike the SMA and EMA, I don't need the overlay for the oscillator
This is the code that I currently have:
study(title="Indicator", overlay = true)
lenSMA = input(26, minval = 1, title = "SMA Length")
lenEMA = input(9, minval = 1, title = "EMA Length")
plot(sma(close, lenSMA), color = color.black, linewidth = 3, title = "Plot SMA")
plot(ema(close, lenEMA), color = color.purple, linewidth = 2, title = "Plot EMA")
periodk = input(14, title = "K", minval = 1)
periodD = input(3, title = "D", minval = 1)
smoothK = input(3, title = "Smoooth", minval = 1)
k = sma(stoch(close, high, low, periodK), smoothK)
d = sma(k, period)
h0 = hline(80)
h1 = hline(20)
fill(h0, h1, color = color.purple, tranps = 75)
But as expected, the stochastic oscillator plots on the actual graph and not on the bottom portion. I want the SMA and EMA to have overlay but not the oscillator.