Smoothed Chaikin Oscillator

Yuzika09 · study · 67 行 · 点赞 15 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

//@version=6
indicator(
     title="Smoothed Chaikin Oscillator",
     shorttitle="Smoothed Chaikin Osc",
     format=format.volume,
     timeframe="",
     timeframe_gaps=true
)
 
// Hacim kontrolü
var float cumVol = 0.0
cumVol += nz(volume)
 
if barstate.islast and cumVol == 0
    runtime.error("No volume is provided by the data vendor.")
 
// Ayarlar
fastLength       = input.int(3, minval=1, title="Fast Length")
slowLength       = input.int(10, minval=1, title="Slow Length")
smoothLength     = input.int(1, minval=1, title="Smoothing Length")
fillTransparency = input.int(80, minval=0, maxval=100, title="Fill Transparency")
 
// Orijinal Chaikin Oscillator
rawOsc = ta.ema(ta.accdist, fastLength) -
         ta.ema(ta.accdist, slowLength)
 
// İlave yumuşatma
osc = smoothLength == 1 ? rawOsc : ta.ema(rawOsc, smoothLength)
 
// Renkler
oscColor = osc >= 0 ? color.green : color.red
 
areaColor = osc >= 0
     ? color.new(color.green, fillTransparency)
     : color.new(color.red, fillTransparency)
 
// Osilatör çizgisi
oscPlot = plot(
     osc,
     title="Smoothed Chaikin Oscillator",
     color=oscColor,
     linewidth=2
)
 
// Dolgu için görünmez sıfır grafiği
zeroPlot = plot(
     0,
     title="Zero Fill Reference",
     color=na,
     editable=false
)
 
// Görünen kesik sıfır çizgisi
hline(
     0,
     title="Zero",
     color=#787B86,
     linestyle=hline.style_dashed
)
 
// Osilatör ile sıfır seviyesi arasındaki dolgu
fill(
     oscPlot,
     zeroPlot,
     color=areaColor,
     title="Positive / Negative Area"
)

← 返回列表