Sonny Dual MA System

SonnyYoung_eth · study · 34 行 · 点赞 4 · TradingView 原页

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

Pine Script

//@version=6
indicator("均线系统", shorttitle="均", overlay=true)
 
// —— 均线计算
sma20  = ta.sma(close, 20)
sma60  = ta.sma(close, 60)
sma120 = ta.sma(close, 120)
 
ema20  = ta.ema(close, 20)
ema60  = ta.ema(close, 60)
ema120 = ta.ema(close, 120)
 
// —— 绘制均线
plot(sma20,  color=color.black,                title="SMA20")
plot(ema20,  color=color.new(color.black, 50), title="EMA20")
 
plot(sma60,  color=color.blue,                 title="SMA60")
plot(ema60,  color=color.new(color.blue, 50),  title="EMA60")
 
plot(sma120, color=color.purple,               title="SMA120")
plot(ema120, color=color.new(color.purple, 50),title="EMA120")
 
// —— 圆点定位
cond    = barstate.islast
bl      = low
 
moveBar = input.int(0,   title="Move Bar")
x20     = input.int(20,  title="X20 Offset")  + moveBar
x60     = input.int(60,  title="X60 Offset")  + moveBar
x120    = input.int(120, title="X120 Offset") + moveBar
 
plot(cond ? bl[20]  : na, color=color.new(#FFC40C, 0), linewidth=5, offset=-x20,  style=plot.style_circles, title="Dot20")
plot(cond ? bl[60]  : na, color=color.new(#FFC40C, 0), linewidth=5, offset=-x60,  style=plot.style_circles, title="Dot60")
plot(cond ? bl[120] : na, color=color.new(#FFC40C, 0), linewidth=5, offset=-x120, style=plot.style_circles, title="Dot120")

← 返回列表