我想添加不同类型的MA(sma,ema,wma等),并为每个指标输入时段和来源(例如,高,低等)。请我只需要一个指南。谢谢。
答案 0 :(得分:1)
您可以搜索公共图书馆。有很多例子。这是一个:https://www.tradingview.com/script/8AUuFonD-5-MAs-w-alerts-LucF/
答案 1 :(得分:1)
这应该让您入门
priceData = input(title="Price Data", type=source, defval=close)
emaValONE = input(title="EMA 1", type=integer, defval=5)
emaValTWO = input(title="EMA 2", type=integer, defval=13)
emaValTHREE = input(title="EMA 3", type=integer, defval=200)
emaValFOUR = input(title="EMA 4", type=integer, defval=800)
emaValFIVE = input(title="EMA 5", type=integer, defval=3200)
// Calculate moving averages
emaONE = ema(priceData, emaValONE)
emaTWO = ema(priceData, emaValTWO)
emaTHREE = ema(priceData, emaValTHREE)
emaFOUR = ema(priceData, emaValFOUR)
emaFIVE = ema(priceData, emaValFIVE)
plot(emaONE, color = red, title="5 EMA",style = line, linewidth = 1, transp = 0)
plot(emaTWO, color = yellow, title="13 EMA",style = line, linewidth = 1, transp = 0)
plot(emaTHREE, color = white, title="200 EMA",style = line, linewidth = 1, transp = 0)
plot(emaFOUR, color = blue, title="800 EMA",style = line, linewidth = 1, transp = 0)
plot(emaFIVE, color = fuchsia, title="3200 EMA",style = line, linewidth = 1, transp = 0)
让我知道这是否有帮助。