OPEN-SOURCE SCRIPT

CCI Buy Signal

//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 CCI
plot(cci, color=color.blue, title="CCI")
hline(100, color=color.red, linestyle=hline.style_dotted, title="Upper Threshold")
hline(0, color=color.gray, linestyle=hline.style_dotted, title="Zero Line")
hline(-100, color=color.red, linestyle=hline.style_dotted, title="Lower Threshold")

// Plot Buy Signal as Arrow
plotshape(buySignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal Arrow")
Candlestick analysisChart patternsWoodies CCI

开源脚本

本着真正的TradingView精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明