OPEN-SOURCE SCRIPT

William wins Adventurous Index fund ver 2.0!

// © Williamtrades10x

//version=5
indicator("McClellan Oscilator")
advn=request.security("ADVN","D",close)
decn=request.security("DECN","D", close)

//calc
ana=(advn-decn)/(advn+decn) * 1000
ema1= ta.ema(ana,19)
ema2= ta.ema(ana,39)
osc=ema1-ema2

//signals
mline = 0
sline = -80
cross=osc<sline

//color
coloring =
osc>=0 and osc>osc[1]? color.green:
osc>=0 and osc<osc[1]? color.new(color.green,50):
osc<0 and osc<osc[1]? color.red:
color.new(color.red,50)


// plot(osc1? osc :na, style=plot.style_area, color=color.red)
// plot(osc2? osc :na, style=plot.style_area, color=color.green)
// plot(osc,color = coloring)
plot(osc,style=plot.style_histogram, color = coloring)
plot(sline, color=color.gray)
plot(mline,color=color.gray)
bgcolor(cross? color.blue : na)

Bill Williams IndicatorsBreadth IndicatorsChart patterns

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer