Normalized KAMA Oscillator | IkkeOmar

IkkeOmar · study · 35 行 · 点赞 243 · TradingView 原页

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

Pine Script

//@version=5
indicator("White Noise", shorttitle = "White Noise [IkkeOmar]")
 
 
 
 
// GET INPUTS //----------------------------------------------------------------------------------
mlen = input.int(147,title="Noise Length")
hlen = input.int(7,title="Hull Length")
 
col_up = input.color(#22ab94)
col_dn = input.color(#f7525f)
 
 
 
 
 
// CALC DATA //------------------------------------------------------------------------------------
ma   = ta.sma(hlc3,mlen)
dist = ((hlc3-ma)/ma)*850
sm   = ta.wma(2 * ta.wma(dist, hlen / 2) - ta.wma(dist, hlen), math.round(math.sqrt(hlen)))
 
 
// COLORING //----------------------------------------------------------------------------------------
col_wn = dist < 0 ? (dist < sm ? color.new(col_dn,50) : color.new(col_dn,75)) : (dist > sm ? color.new(col_up,50) : color.new(col_up,75))
col_switch  = ta.crossover(sm,sm[1]) ? col_up : ta.crossunder(sm,sm[1]) ? col_dn : color.rgb(0,0,0,100)
col_switch2 = ta.crossover(sm,sm[1]) or ta.crossunder(sm,sm[1]) ? color.black : color.rgb(0,0,0,100) 
 
 
// PLOT //----------------------------------------------------------------------------------------
 
plot(dist     ,style=plot.style_columns,color=col_wn)
 
plot(sm       , color=color.white,linewidth=2)
plot(sm[1]    , color=color.new(color.white,50))

← 返回列表