Gideons Gold - EMA Shield

gideonsgold · study · 51 行 · 点赞 21 · TradingView 原页

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

Pine Script

// ©2026 Gideons Gold — EMA Shield
//@version=6
indicator("Gideons Gold — EMA Shield", shorttitle = "Gideons Gold — EMA Shield", overlay = true)
 
// ───────────── Channel Settings ─────────────
len = input.int(
    20,
    "EMA Length",
    minval = 1,
    tooltip = "Number of bars used to calculate both EMAs.",
    group = "Channel Settings"
)
 
// ───────────── Appearance ─────────────
bullColor = input.color(color.green, "Above Channel", group = "Appearance")
bearColor = input.color(color.red, "Below Channel", group = "Appearance")
neutralColor = input.color(color.orange, "Inside Channel", group = "Appearance")
 
lineWidth = input.int(
    2,
    "Line Width",
    minval = 1,
    maxval = 5,
    group = "Appearance"
)
 
showFill = input.bool(true, "Show Channel Fill", group = "Appearance")
 
fillTransparency = input.int(
    85,
    "Fill Transparency",
    minval = 0,
    maxval = 100,
    group = "Appearance"
)
 
// ───────────── Calculations ─────────────
emaHigh = ta.ema(high, len)
emaLow = ta.ema(low, len)
 
chColor = close < emaLow ? bearColor : close > emaHigh ? bullColor : neutralColor
 
// ───────────── Plots ─────────────
pHigh = plot(emaHigh, "EMA High", color = chColor, linewidth = lineWidth)
pLow = plot(emaLow, "EMA Low", color = chColor, linewidth = lineWidth)
 
fill(
    pHigh,
    pLow,
    color = showFill ? color.new(chColor, fillTransparency) : na
)

← 返回列表