Delta Divergence Alert

Fractal_Firmament · study · 19 行 · 点赞 176 · TradingView 原页

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

Pine Script

//@version=6
indicator("Delta Divergence Alert", overlay = true)
 
ticksInput = input.int(1, "Ticks per row", minval = 1)
minDelta   = input.float(0, "Minimum |delta| to count", minval = 0,
     tooltip = "Ignore divergences where delta is tiny. 0 = flag every one.")
 
footprint fp = request.footprint(ticksInput, 70)
float d = na(fp) ? na : fp.delta()
 
bool bullDiv = close > open and d < -minDelta   // green candle, negative delta
bool bearDiv = close < open and d >  minDelta   // red candle, positive delta
 
plotshape(bullDiv, "Green / neg delta", shape.triangleup,   location.belowbar, color.lime, size = size.small)
plotshape(bearDiv, "Red / pos delta",   shape.triangledown, location.abovebar, color.red,  size = size.small)
 
alertcondition(bullDiv,           "Bullish delta divergence", "Green candle closed with negative delta on {{ticker}}")
alertcondition(bearDiv,           "Bearish delta divergence", "Red candle closed with positive delta on {{ticker}}")
alertcondition(bullDiv or bearDiv, "Any delta divergence",    "Delta divergence on {{ticker}} ({{interval}})")

← 返回列表