EMA 8/21 Cross

pinkythebrain · study · 20 行 · 点赞 1 · TradingView 原页

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

Pine Script

//@version=6
indicator("EMA 8/21 Cross", overlay=true)
 
fastLen = input.int(8, "Fast EMA")
slowLen = input.int(21, "Slow EMA")
 
fast = ta.ema(close, fastLen)
slow = ta.ema(close, slowLen)
 
bullCross = ta.crossover(fast, slow)
bearCross = ta.crossunder(fast, slow)
 
plot(fast, "Fast EMA", color=color.new(color.aqua, 0))
plot(slow, "Slow EMA", color=color.new(color.orange, 0))
 
plotshape(bullCross, "Bull Cross", shape.triangleup, location.belowbar, color.green, size=size.small)
plotshape(bearCross, "Bear Cross", shape.triangledown, location.abovebar, color.red, size=size.small)
 
alertcondition(bullCross, "8/21 Bullish Cross", "8 EMA crossed above 21 EMA on {{ticker}} ({{interval}})")
alertcondition(bearCross, "8/21 Bearish Cross", "8 EMA crossed below 21 EMA on {{ticker}} ({{interval}})")// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

← 返回列表