So, I've been trying to modify some indicators to suit my trading strategy and I need to add a zero line to the SMI Ergodic Indicator (not oscillator) which I've done and also need circles to be plotted whenever the SMI line crosses the signal line but I don't have any idea on how to get through that. I want circles of a certain colour to be plotted whenever the two lines cross each other below the zero line and circles of another colour to be plotted whenever the two lines cross each other above the zero line. Anyone nice enough to help. Thanks y'all.
This is the code below. Everything was successful except that I don't know how to add what I said above.
//@version=4
study(title="SMI Ergodic Indicator", shorttitle="SMII", format=format.price, precision=4, resolution="")
longlen = input(20, minval=1, title="Long Period")
shortlen = input(5, minval=1, title="Short Period")
siglen = input(5, minval=1, title="Signal Line Period")
erg = tsi(close, shortlen, longlen)
sig = ema(erg, siglen)
plot(erg, color=#0094FF, title="SMI")
plot(sig, color=#FF6A00, title="Signal")
hline(0, title="Zero", color=color.white, linestyle=hline.style_dashed, linewidth=1)
//@version=4
study(title="Help (SMI Ergodic Indicator)", shorttitle="SMII", format=format.price, precision=4, resolution="")
longlen = input(20, minval=1, title="Long Period")
shortlen = input(5, minval=1, title="Short Period")
siglen = input(5, minval=1, title="Signal Line Period")
erg = tsi(close, shortlen, longlen)
sig = ema(erg, siglen)
plot(erg, color=#0094FF, title="SMI")
plot(sig, color=#FF6A00, title="Signal")
hline(0, title="Zero", color=color.gray, linestyle=hline.style_dashed, linewidth=1)
plot(cross(sig, erg) and sig>0 ? sig : na, color=color.green, style=plot.style_circles, linewidth=2)
plot(cross(sig, erg) and sig<0 ? sig : na, color=color.red, style=plot.style_circles, linewidth=2)