本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
//@version=6
indicator("Omarnowick Style - Realtime Momentum 5 Ticks", overlay=true, max_labels_count=500)
// ─────────────────────────────────────────────
// INSTELLINGEN
// ─────────────────────────────────────────────
minMoveTicks = input.int(5, "Minimale momentum (ticks)", minval=1)
wickToleranceTicks = input.int(0, "Wick-tolerantie (ticks)", minval=0, maxval=10)
showSignals = input.bool(true, "BUY/SELL-labels tonen")
colorCandles = input.bool(true, "Signaalcandles kleuren")
// ─────────────────────────────────────────────
// PRIJS- EN CANDLELOGICA
// ─────────────────────────────────────────────
minMove = minMoveTicks * syminfo.mintick
wickTolerance = wickToleranceTicks * syminfo.mintick
bullish = close > open
bearish = close < open
// BUY: geen onderste wick.
// SELL: geen bovenste wick.
noLowerWick = low >= open - wickTolerance
noUpperWick = high <= open + wickTolerance
// Momentum moet minimaal 5 ticks vanaf de opening zijn.
buySetup = bullish and noLowerWick and close >= open + minMove
sellSetup = bearish and noUpperWick and close <= open - minMove
// ─────────────────────────────────────────────
// EEN ALERT PER RICHTING PER CANDLE
// varip bewaart de status tussen realtime updates.
// ─────────────────────────────────────────────
varip bool buyAlerted = false
varip bool sellAlerted = false
if barstate.isnew
buyAlerted := false
sellAlerted := false
// Alert alleen zodra de setup voor het eerst ontstaat.
if barstate.isrealtime and buySetup and not buyAlerted
alert("BUY | Realtime momentum zonder onderste wick | " + syminfo.ticker + " | TF: " + timeframe.period + " | Prijs: " + str.tostring(close, format.mintick), alert.freq_all)
buyAlerted := true
if barstate.isrealtime and sellSetup and not sellAlerted
alert("SELL | Realtime momentum zonder bovenste wick | " + syminfo.ticker + " | TF: " + timeframe.period + " | Prijs: " + str.tostring(close, format.mintick), alert.freq_all)
sellAlerted := true
// ─────────────────────────────────────────────
// VISUELE SIGNALEN
// ─────────────────────────────────────────────
barcolor(colorCandles ? buySetup ? color.lime : sellSetup ? color.red : na : na)
plotshape(showSignals and buySetup, title="BUY Momentum", style=shape.labelup, location=location.belowbar, color=color.lime, text="BUY", textcolor=color.black, size=size.small)
plotshape(showSignals and sellSetup, title="SELL Momentum", style=shape.labeldown, location=location.abovebar, color=color.red, text="SELL", textcolor=color.white, size=size.small)