ChrisMoody

CM_Enhanced CCI V2

Added 0 Line, + - 200 lines

Added a line that hi-lights the outside of the CCI

Updated 8/12/2014 by request for christian.david.75457

Added Ability To Plot 2nd CCI - !!!

Added ability to turn On/Off the +-200 lines.

Added Ability to Turn On/Off Show Area of CCI

Added Ability To Turn On/Off Show The Outer CCI Line

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 a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//created by user ChrisMoody 2-2-2014
//Added 0 Line, +-200 lines, a line that hilights the outside of the CCI
//Updated 8/12/2014 by request for christian.david.75457
//Added Ability To Plot 2nd CCI
//Added ability to turn On/Off the +-200 lines.
//Added Ability to Turn On/Off Show Area of CCI and ability To Turn On/Off Show The Outer CCI Line
study(title="CM_Enhanced CCI V2", shorttitle="CM_Enhanced CCI V2", precision=0)
source = close
length = input(30, minval=1, title="Main CCI Length")
sol = input(true, title="Show Outer CCI Line")
shCCI2 = input(true, title="Show 2nd CCI?")
shHist = input(true, title="Show CCI Histogram?")
length2 = input(14, minval=1, title="2nd CCI Length")
sh200 = input(true, title="Show +200 and -200 Lines?")
//CCI 1
ma = sma(source, length)
cci = (source - ma) / (0.015 * dev(source, length))
maCCI1 = sma(cci, 1)
//CCI 2
ma2 = sma(source, length2)
cci2 = shCCI2 and (source - ma2) / (0.015 * dev(source, length2)) ? (source - ma2) / (0.015 * dev(source, length2)) : na
maCCI2 = shCCI2 and sma(cci2, 1) ? sma(cci2, 1) : na

plot(shHist and cci ? cci : na, title='CCI', color=green, style=areabr, linewidth=3, transp=20)
plot(sol and maCCI1 ? maCCI1 : na, title='OuterCCI Highlight', color=lime, style=line, linewidth=4)

plot(shHist and cci2 ? cci2 : na, title='CCI 2nd Line', color=red, style=columns, transp=60)
plot(sol and maCCI2 ? maCCI2 : na, title='OuterCCI Highlight 2nd Line', color=red, style=line, linewidth=3)

band1 = hline(100, title='100 Line',color=white, linestyle=dashed, linewidth=3)
band0 = hline(-100, title='-100 Line', color=white, linestyle=dashed, linewidth=3)
fill(band1, band0, color=white, transp=70)

plot(sh200 and 200 ? 200 : na, title="200 Line",color=red, style=line, linewidth=3)
plot(sh200 and -200 ? -200 : na, title='-200 Line', color=lime, style=line, linewidth=3)
hline(0, title='0 Line', color=white, linestyle=solid, linewidth=2)