本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator("15M Delta Flip + Parabolic SAR", overlay=true, max_labels_count=100)
// === SETTINGS ===
minDelta = input.float(20.0, "Minimum Delta", minval=0)
showSAR = input.bool(true, "Show Parabolic SAR")
sarStart = input.float(0.02, "SAR Start", minval=0.001, step=0.001)
sarIncrement = input.float(0.02, "SAR Increment", minval=0.001, step=0.001)
sarMaximum = input.float(0.20, "SAR Maximum", minval=0.01, step=0.01)
// === TIMEFRAME FILTER ===
is15m = timeframe.isminutes and timeframe.multiplier == 15
// === ESTIMATED DELTA ===
// Candle-direction volume estimate, NOT true bid/ask delta.
buyVolume = close > open ? volume : close == open ? volume * 0.5 : 0.0
sellVolume = close < open ? volume : close == open ? volume * 0.5 : 0.0
delta = buyVolume - sellVolume
// === DELTA FLIPS ===
positiveFlip = delta >= minDelta and delta[1] <= -minDelta
negativeFlip = delta <= -minDelta and delta[1] >= minDelta
// === PARABOLIC SAR ===
sar = ta.sar(sarStart, sarIncrement, sarMaximum)
sarColor = sar < close ? color.lime : color.red
plot(is15m and showSAR ? sar : na,
title="Parabolic SAR",
style=plot.style_circles,
color=sarColor,
linewidth=2)
// === CLEAN SIGNALS ===
plotshape(is15m and positiveFlip,
title="Positive Delta Flip",
style=shape.triangleup,
location=location.belowbar,
color=color.lime,
size=size.small,
text="+20",
textcolor=color.lime)
plotshape(is15m and negativeFlip,
title="Negative Delta Flip",
style=shape.triangledown,
location=location.abovebar,
color=color.red,
size=size.small,
text="-20",
textcolor=color.red)
// === ALERTS ===
alertcondition(is15m and positiveFlip,
title="15M Delta Positive Flip",
message="15-minute estimated delta flipped positive on {{ticker}}")
alertcondition(is15m and negativeFlip,
title="15M Delta Negative Flip",
message="15-minute estimated delta flipped negative on {{ticker}}")