681
Show Daily level SMAs on chart regardless of current interval.
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
//@version=2
study("DMAs", overlay=true)

// options
n1on = input(false, title="5 DMA")
n2on = input(false, title="10 DMA")
n3on = input(false, title="20 DMA")
n4on = input(true, title="50 DMA")
n5on = input(true, title="100 DMA")
n6on = input(false, title="150 DMA")
n7on = input(false, title="200 DMA")

plot((n1on)?security(tickerid, "D", sma(close, 5)):na, title="5 DMA", color=#970000, linewidth=1, style=line, transp=0)
plot((n2on)?security(tickerid, "D", sma(close, 10)):na, title="10 DMA", color=red, linewidth=1, style=line, transp=0)
plot((n3on)?security(tickerid, "D", sma(close, 20)):na, title="20 DMA", color=#FF9800, linewidth=1, style=line, transp=0)
plot((n4on)?security(tickerid, "D", sma(close, 50)):na, title="50 DMA", color=yellow, linewidth=1, style=line, transp=0)
plot((n5on)?security(tickerid, "D", sma(close, 100)):na, title="100 DMA", color=lime, linewidth=1, style=line, transp=0)
plot((n6on)?security(tickerid, "D", sma(close, 150)):na, title="150 DMA", color=#00FFFF, linewidth=1, style=line, transp=0)
plot((n7on)?security(tickerid, "D", sma(close, 200)):na, title="200 DMA", color=#4985E7, linewidth=1, style=line, transp=0)