OPEN-SOURCE SCRIPT

CCI Buy Signal

Updated
CCI BUY SIGNAL WEEKLY indicator to buy MF ETF on index for long term
Release Notes
cci indicator to buy weekly tf etf mutual fund for long term duration
Release Notes
//version=5
indicator("CCI Buy Signal", overlay=true)

// Inputs for CCI
length = input.int(14, title="CCI Length")
src = input.source(close, title="Source")

// Calculate CCI
cci = ta.cci(src, length)
prev_cci = ta.valuewhen(bar_index > 0, cci[1], 0)

// Buy condition
buySignal = (cci < -100) and (cci > prev_cci)

// Plot Buy Signal as Arrow on Chart
plotshape(buySignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal Arrow")
Release Notes
//version=5
indicator("CCI Buy Signal", overlay=true)

// Inputs for CCI
length = input.int(14, title="CCI Length")
src = input.source(close, title="Source")

// Calculate CCI
cci = ta.cci(src, length)
prev_cci = ta.valuewhen(bar_index > 0, cci[1], 0)

// Buy condition
buySignal = (prev_cci < -200) and (cci > prev_cci) and (cci > -200)

// Plot Buy Signal as Arrow on Chart
plotshape(buySignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal Arrow")
Bill Williams IndicatorsbuyCommodity Channel Index (CCI)indexOscillatorsWeekly Charts

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