OPEN-SOURCE SCRIPT

均线系统

//version=5
indicator(title="均线系统", shorttitle="均", overlay=true)

// 计算各周期的SMA和EMA
// 5 日:红色, 10 日:蓝色, 20 日:绿色, 30 日:紫色, 67 日:黄色, 120 日:teal, 240 日:黑色, 365 日:橙色

// 计算 SMA
sma5 = ta.sma(close, 5)
sma10 = ta.sma(close, 10)
sma20 = ta.sma(close, 20)
sma30 = ta.sma(close, 30)
sma67 = ta.sma(close, 67)
sma120 = ta.sma(close, 120)
sma240 = ta.sma(close, 240)
sma365 = ta.sma(close, 365)

// 计算 EMA
ema5 = ta.ema(close, 5)
ema10 = ta.ema(close, 10)
ema20 = ta.ema(close, 20)
ema30 = ta.ema(close, 30)
ema67 = ta.ema(close, 67)
ema120 = ta.ema(close, 120)
ema240 = ta.ema(close, 240)
ema365 = ta.ema(close, 365)

// 绘制 SMA
plot(sma5, color=color.red, title="SMA5")
plot(sma10, color=color.blue, title="SMA10")
plot(sma20, color=color.green, title="SMA20")
plot(sma30, color=color.purple, title="SMA30")
plot(sma67, color=color.yellow, title="SMA67")
plot(sma120, color=color.teal, title="SMA120")
plot(sma240, color=color.black, title="SMA240")
plot(sma365, color=color.orange, title="SMA365")

// 绘制 EMA
plot(ema5, color=color.new(color.red, 50), title="EMA5")
plot(ema10, color=color.new(color.blue, 50), title="EMA10")
plot(ema20, color=color.new(color.green, 50), title="EMA20")
plot(ema30, color=color.new(color.purple, 50), title="EMA30")
plot(ema67, color=color.new(color.yellow, 50), title="EMA67")
plot(ema120, color=color.new(color.teal, 50), title="EMA120")
plot(ema240, color=color.new(color.black, 50), title="EMA240")
plot(ema365, color=color.new(color.orange, 50), title="EMA365")

// 条件和偏移设置
cond = barstate.islast
bl = low
moveBar = input.int(0, title="移动栏")
x5 = input.int(5, title="X5 Offset") + moveBar
x10 = input.int(10, title="X10 Offset") + moveBar
x20 = input.int(20, title="X20 Offset") + moveBar
x30 = input.int(30, title="X30 Offset") + moveBar
x67 = input.int(67, title="X67 Offset") + moveBar
x120 = input.int(120, title="X120 Offset") + moveBar
x240 = input.int(240, title="X240 Offset") + moveBar
x365 = input.int(365, title="X365 Offset") + moveBar

// 绘制圆圈标记
plot(cond ? bl[5] : na, color=color.red, linewidth=5, offset=-x5, style=plot.style_circles, transp=0, title="低点 5 日")
plot(cond ? bl[10] : na, color=color.blue, linewidth=5, offset=-x10, style=plot.style_circles, transp=0, title="低点 10 日")
plot(cond ? bl[20] : na, color=color.green, linewidth=5, offset=-x20, style=plot.style_circles, transp=0, title="低点 20 日")
plot(cond ? bl[30] : na, color=color.purple, linewidth=5, offset=-x30, style=plot.style_circles, transp=0, title="低点 30 日")
plot(cond ? bl[67] : na, color=color.yellow, linewidth=5, offset=-x67, style=plot.style_circles, transp=0, title="低点 67 日")
plot(cond ? bl[120] : na, color=color.teal, linewidth=5, offset=-x120, style=plot.style_circles, transp=0, title="低点 120 日")
plot(cond ? bl[240] : na, color=color.black, linewidth=5, offset=-x240, style=plot.style_circles, transp=0, title="低点 240 日")
plot(cond ? bl[365] : na, color=color.orange, linewidth=5, offset=-x365, style=plot.style_circles, transp=0, title="低点 365 日")
Candlestick analysis

Skrip open-source

Dengan semangat TradingView yang sesungguhnya, penulis skrip ini telah menerbitkannya sebagai sumber terbuka, sehingga para trader dapat memahami dan memverifikasinya. Hormat untuk penulisnya! Anda dapat menggunakannya secara gratis, namun penggunaan kembali kode ini dalam publikasi diatur oleh Tata Tertib. Anda dapat memfavoritkannya untuk digunakan pada chart

Inggin menggunakan skrip ini pada chart?

Pernyataan Penyangkalan