本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=1
// source: http://etfhq.com/blog/2013/01/15/golden-cross-which-is-the-best/#Top
study(title="Golden Cross", overlay=true)
// fast ma
maFastSource = input(defval = close, title = "Fast MA Source")
maFastLength = input(defval = 13, title = "Fast MA Period", minval = 1)
// longest ma
maSlowestSource = input(defval = close, title = "Slow MA Source")
maSlowestLength = input(defval = 49, title = "Slow MA Period", minval = 1)
fastMA = ema(maFastSource, maFastLength)
slowestMA = ema(maSlowestSource, maSlowestLength)
plot(series=fastMA, color=red, linewidth=2)
plot(series=slowestMA, color = yellow, linewidth=2)
plot(cross(fastMA, slowestMA) ? fastMA : na, style=cross, linewidth = 6, color=yellow)