Indicator · Pine Script v6 · On the chart

Reversal Engine Score v1 [WavesUnchained]

by casoon

This overlay indicator scores liquidity-sweep reversals on the price chart.

View on GitHub

GitHub stars9on the repository
Pine versionv6current
Lines of code438
Settings40inputs
LicenceMIT
Last updateyesterday27 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

438 lines of Pine Script v6 from indicators/momentum/reversal_engine_score/reversal_engine_score_v1.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

reversal_engine_score_v1.pine
//@version=6
// ============================================================================
// Reversal Engine Score v1 [WavesUnchained]
// Version: 1.7.3
// Author: WavesUnchained
// Build: 2026-10-12 00:00:00
// ============================================================================
// Score-based liquidity sweep reversal detector with HTF trend confluence.
//
// Features:
//   ✓ Sweep trigger with graded quality instead of hard filter chain
//   ✓ Quality score (0–2 role conditions) replaces additive sum
//   ✓ Per-direction quality thresholds (Long/Short configurable separately)
//   ✓ Short optionals: RSI > 50 (elevated), no HH
//   ✓ Structural SL — sweep low/high as base + configurable ATR noise buffer
//   ✓ R-multiple TP — adapts to actual risk distance (TP = entry ± risk × factor)
//   ✓ ATR corridor filter — rejects both low-volatility noise and spike regimes
//   ✓ Spike filter — blocks sweeps deeper than N×ATR (real breakdowns, not reversals)
//   ✓ Session filter — optionally restricts signals to a configurable intraday window
//   ✓ Liquidity sweep detection (swing violation + recovery close)
//   ✓ HTF trend filter via dual EMA on configurable timeframe
//   ✓ Price structure labels (HH / HL / LH / LL) at confirmed pivots
//   ✓ Outcome-based label coloring (blue = no follow-through within N bars)
//   ✓ Cooldown gate to suppress chasing
//   ✓ Alert conditions for BUY / SELL / either
//
// ============================================================================

indicator("Reversal Engine Score v1 [WavesUnchained]",
         shorttitle       = "RES v1",
         overlay          = true,
         max_labels_count = 500,
         max_lines_count  = 500)

// Synthetische Bar-Preise (Heikin Ashi, Renko …): Orders füllen zu Marktpreisen,
// der Backtest gilt dort nicht. Kurzer Hinweis unten rechts statt auf der Kerze.
var table chartTypeWarn = table.new(position.bottom_right, 1, 1)
if barstate.islast and not chart.is_standard
    table.cell(chartTypeWarn, 0, 0, "RES v1 · backtest invalid on this chart type",
         bgcolor = color.new(color.red, 10), text_color = color.white, text_size = size.small)

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// — Anzeige —
g_display = "Anzeige"
only15m             = input.bool(true,  "Nur auf 15M aktiv",        group = g_display)
showLevels          = input.bool(true,  "SL/TP-Level anzeigen",     group = g_display)
showTrendBackground = input.bool(false, "Trend-Hintergrund",        group = g_display)
showScoreLabel      = input.bool(true,  "Score am Signal anzeigen", group = g_display)
tradeDir            = input.string("Both", "Handelsrichtung",       group = g_display,
     options = ["Both", "Long Only", "Short Only"])

// — Signal-Qualität —
g_quality = "Signal-Qualität"
minQualityLong  = input.int(2, "Min. Qualität Long (0–2)",  minval = 0, maxval = 2, group = g_quality,
     tooltip = "Mindestanzahl optionaler Bedingungen für Longs. 2 = alle Optionals erforderlich (empfohlen).")
minQualityShort = input.int(1, "Min. Qualität Short (0–2)", minval = 0, maxval = 2, group = g_quality,
     tooltip = "Mindestanzahl optionaler Bedingungen für Shorts.")
rsiLen = input.int(14, "RSI Länge", minval = 1, group = g_quality)

// — Pflicht-Gates —
g_gates   = "Pflicht-Gates"
useGateA = input.bool(true, "Gate A — Liquidity Sweep", group = g_gates)
swingLen = input.int(10, "  [A] Sweep Lookback", minval = 2, group = g_gates)

useGateB = input.bool(false, "Gate B — Close-Position (⅓-Regel)", group = g_gates)

useGateC = input.bool(false, "Gate C — Body-Größe", group = g_gates)
minBodyAtr = input.float(0.25, "  [C] Min. Body / ATR", step = 0.05, group = g_gates)

useGateD     = input.bool(true, "Gate D — ATR Minimum", group = g_gates)
atrLen       = input.int(14,    "  [D] ATR Länge",      minval = 1, group = g_gates)
atrBaseLen   = input.int(50,    "  [D] ATR Basislänge", minval = 5, group = g_gates)
atrLowFactor = input.float(0.60, "  [D] Min (× Basis)", step = 0.05, group = g_gates)

useGateE     = input.bool(false, "Gate E — Spike-Filter", group = g_gates)
spikeAtrMult = input.float(0.80, "  [E] Max Sweep-Tiefe (ATR×)", step = 0.05, group = g_gates)

useGateF   = input.bool(true,  "Gate F — HTF Trendfilter", group = g_gates)
htf        = input.timeframe("60", "  [F] Timeframe",   group = g_gates)
htfFastLen = input.int(50,         "  [F] EMA schnell", minval = 1, group = g_gates)
htfSlowLen = input.int(200,        "  [F] EMA langsam", minval = 1, group = g_gates)

useGateG  = input.bool(false, "Gate G — 1H WT Confluence", group = g_gates)
wtChLen   = input.int(10,    "  [G/H] WT Channel Length", minval = 1,  group = g_gates)
wtAvgLen  = input.int(21,    "  [G/H] WT Average Length", minval = 1,  group = g_gates)
gateG_os  = input.float(-30.0, "  [G] 1H OS Threshold (long)",  step = 1.0, group = g_gates)
gateG_ob  = input.float( 30.0, "  [G] 1H OB Threshold (short)", step = 1.0, group = g_gates)

useGateH  = input.bool(false, "Gate H — 4H WT Confluence", group = g_gates)
gateH_os  = input.float(-30.0, "  [H] 4H OS Threshold (long)",  step = 1.0, group = g_gates)
gateH_ob  = input.float( 30.0, "  [H] 4H OB Threshold (short)", step = 1.0, group = g_gates)

useGateI    = input.bool(false,          "Gate I — Session-Filter",       group = g_gates,
     tooltip = "Signale nur innerhalb der gewählten Session. Format: HHMM-HHMM (Börsen-Lokalzeit). Beispiele: 0700-1200 (Europa Vmttg), 1400-1800 (US Vmttg).")
sessionInput = input.session("0700-1200", "  [I] Session (Börsenzeit)",    group = g_gates)

// — Reclaim MA —
g_ma      = "Reclaim MA"
emaLen     = input.int(21,       "Länge", minval = 1, group = g_ma)
smoothType = input.string("EMA", "Typ",   group = g_ma,
     options = ["EMA", "RMA", "SMA", "WMA", "HMA", "JMA"])
jmaPhase   = input.int(50,       "  JMA Phase", minval = -100, maxval = 100, group = g_ma)
jmaPower   = input.float(2.0,    "  JMA Power", minval = 1.0,  maxval = 4.0, step = 0.25, group = g_ma)

// — SL / TP —
g_sltp    = "SL / TP"
slAtrBuffer = input.float(0.30, "SL Puffer (ATR×)",  step = 0.05, group = g_sltp)
tpRMult     = input.float(1.50, "TP Risk-Multiple",  step = 0.1,  group = g_sltp)
sigCooldown = input.int(5,      "Cooldown nach Signal", minval = 0, group = g_sltp)

gStruct = "Marktstruktur"
pivLen     = input.int(5,     "Pivot Length",                          minval = 2, maxval = 20, group = gStruct)
showPivots = input.bool(false, "Struktur-Labels (HH/HL/LH/LL) anzeigen",                       group = gStruct)

gOutcome = "Outcome"
outcomeWindow = input.int(20, "Outcome-Fenster (Bars)", minval = 5, maxval = 500, group = gOutcome)

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// 15M Check
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
is15m    = timeframe.period == "15"
isActive = only15m ? is15m : true

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Smoothing helpers
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
f_jma(src, length, phase, power) =>
    var float jma = na
    var float e0  = na
    var float e1  = na
    var float e2  = na
    _pr    = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100.0 + 1.5
    _beta  = 0.45 * (length - 1) / (0.45 * (length - 1) + 2)
    _alpha = math.pow(_beta, power)
    e0    := (1 - _alpha) * src + _alpha * nz(e0[1], src)
    e1    := (src - e0) * (1 - _beta) + _beta * nz(e1[1], 0)
    e2    := (e0 + _pr * e1 - nz(jma[1], src)) * math.pow(1 - _alpha, 2) + math.pow(_alpha, 2) * nz(e2[1], 0)
    jma   := nz(jma[1], src) + e2
    jma

f_smooth(src, length, mode) =>
    switch mode
        'SMA' => ta.sma(src, length)
        'RMA' => ta.rma(src, length)
        'HMA' => ta.hma(src, length)
        'WMA' => ta.wma(src, length)
        'JMA' => f_jma(src, length, jmaPhase, jmaPower)
        =>       ta.ema(src, length)

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
emaReclaim = f_smooth(close, emaLen, smoothType)
rsiValue   = ta.rsi(close, rsiLen)
atrValue   = ta.atr(atrLen)
atrBase    = ta.sma(atrValue, atrBaseLen)
htfEmaFast = request.security(syminfo.tickerid, htf, ta.ema(close, htfFastLen), barmerge.gaps_off, barmerge.lookahead_off)
htfEmaSlow = request.security(syminfo.tickerid, htf, ta.ema(close, htfSlowLen), barmerge.gaps_off, barmerge.lookahead_off)
bullTrend  = htfEmaFast > htfEmaSlow
bearTrend  = htfEmaFast < htfEmaSlow

f_wt1(src, chLen, avgLen) =>
    _esa = ta.ema(src, chLen)
    _d   = ta.ema(math.abs(src - _esa), chLen)
    _ci  = (src - _esa) / (0.015 * _d)
    ta.ema(_ci, avgLen)

wt1_1H = request.security(syminfo.tickerid, "60",  f_wt1(hlc3, wtChLen, wtAvgLen), barmerge.gaps_off, barmerge.lookahead_off)
wt1_4H = request.security(syminfo.tickerid, "240", f_wt1(hlc3, wtChLen, wtAvgLen), barmerge.gaps_off, barmerge.lookahead_off)

prevSwingLow  = ta.lowest(low[1],  swingLen)
prevSwingHigh = ta.highest(high[1], swingLen)

rangeValue = high - low
bodyValue  = math.abs(close - open)

closeInUpperThird = rangeValue > 0 and close > low  + rangeValue * 0.65
closeInLowerThird = rangeValue > 0 and close < high - rangeValue * 0.65

liquiditySweepLong  = low  < prevSwingLow  and close > prevSwingLow
liquiditySweepShort = high > prevSwingHigh and close < prevSwingHigh

atrOk  = atrValue > atrBase * atrLowFactor
bodyOk = bodyValue > atrValue * minBodyAtr

sweepDepthLong       = prevSwingLow  - low
sweepDepthShort      = high - prevSwingHigh
sweepNotTooDeepLong  = not useGateE or sweepDepthLong  <= atrValue * spikeAtrMult
sweepNotTooDeepShort = not useGateE or sweepDepthShort <= atrValue * spikeAtrMult
sessionOk            = not useGateI or not na(time(timeframe.period, sessionInput))

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Price structure (HH / HL / LH / LL)
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
_phFound = not na(ta.pivothigh(high, pivLen, pivLen))
_plFound = not na(ta.pivotlow(low,   pivLen, pivLen))

var float _lastSwingHigh1 = na
var float _lastSwingHigh2 = na
var float _lastSwingLow1  = na
var float _lastSwingLow2  = na

if _phFound
    _lastSwingHigh2 := _lastSwingHigh1
    _lastSwingHigh1 := high[pivLen]
if _plFound
    _lastSwingLow2 := _lastSwingLow1
    _lastSwingLow1 := low[pivLen]

hasHighStructure = not na(_lastSwingHigh1) and not na(_lastSwingHigh2)
hasLowStructure  = not na(_lastSwingLow1)  and not na(_lastSwingLow2)

hhDetected = hasHighStructure and _lastSwingHigh1 > _lastSwingHigh2
lhDetected = hasHighStructure and _lastSwingHigh1 < _lastSwingHigh2
hlDetected = hasLowStructure  and _lastSwingLow1  > _lastSwingLow2
llDetected = hasLowStructure  and _lastSwingLow1  < _lastSwingLow2

longPivotFail  = hasLowStructure  and llDetected
shortPivotFail = hasHighStructure and hhDetected

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Signal logic — Gates + Graded Quality (0-2)
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

longGateOk  = (not useGateA or liquiditySweepLong)       and
              (not useGateB or closeInUpperThird)         and
              (not useGateC or bodyOk)                    and
              (not useGateD or atrOk)                     and
              sweepNotTooDeepLong                         and
              (not useGateF or not bearTrend)             and
              (not useGateG or wt1_1H <= gateG_os)        and
              (not useGateH or wt1_4H <= gateH_os)        and
              sessionOk

shortGateOk = (not useGateA or liquiditySweepShort)      and
              (not useGateB or closeInLowerThird)         and
              (not useGateC or bodyOk)                    and
              (not useGateD or atrOk)                     and
              sweepNotTooDeepShort                        and
              (not useGateF or not bullTrend)             and
              (not useGateG or wt1_1H >= gateG_ob)        and
              (not useGateH or wt1_4H >= gateH_ob)        and
              sessionOk

longQuality  = 0
longQuality  += rsiValue > 50  ? 1 : 0
longQuality  += not llDetected ? 1 : 0

shortQuality  = 0
shortQuality  += rsiValue > 50  ? 1 : 0
shortQuality  += not hhDetected ? 1 : 0

// Quality tier label (max points = 2)
f_tier(q) =>
    q >= 2 ? "A" : q >= 1 ? "B" : "C"

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Cooldown + final signals
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
var int lastSignalBar = na
cooldownOk = na(lastSignalBar) or bar_index - lastSignalBar > sigCooldown

rawLongSignal  = isActive and longGateOk  and longQuality  >= minQualityLong  and tradeDir != "Short Only"
rawShortSignal = isActive and shortGateOk and shortQuality >= minQualityShort and tradeDir != "Long Only"
longSignal  = rawLongSignal  and cooldownOk and barstate.isconfirmed
shortSignal = rawShortSignal and cooldownOk and barstate.isconfirmed

if longSignal or shortSignal
    lastSignalBar := bar_index

// Keep longScore/shortScore as aliases for strategy log compatibility
longScore  = longQuality
shortScore = shortQuality

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Strategy-ready values
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
entryLong  = longSignal  ? close : na
entryShort = shortSignal ? close : na
_lStructSL = math.min(low, prevSwingLow)  - atrValue * slAtrBuffer
_sStructSL = math.max(high, prevSwingHigh) + atrValue * slAtrBuffer
longStop   = longSignal  ? _lStructSL : na
longTake   = longSignal  ? close + (close - _lStructSL) * tpRMult : na
shortStop  = shortSignal ? _sStructSL : na
shortTake  = shortSignal ? close - (_sStructSL - close) * tpRMult : na

signalDirection = longSignal ? 1 : shortSignal ? -1 : 0
signalScore     = longSignal ? longQuality : shortSignal ? shortQuality : na

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Plots
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
plot(emaReclaim, "Reclaim MA", color = color.new(color.blue, 0), linewidth = 1)

plotshape(longSignal,  title = "BUY Signal",  style = shape.triangleup,   location = location.belowbar, size = size.small, color = color.lime, text = "BUY")
plotshape(shortSignal, title = "SELL Signal", style = shape.triangledown, location = location.abovebar, size = size.small, color = color.red,  text = "SELL")

plot(showLevels ? longStop  : na, "Long SL",  color = color.new(color.red,   0), style = plot.style_linebr)
plot(showLevels ? longTake  : na, "Long TP",  color = color.new(color.green, 0), style = plot.style_linebr)
plot(showLevels ? shortStop : na, "Short SL", color = color.new(color.red,   0), style = plot.style_linebr)
plot(showLevels ? shortTake : na, "Short TP", color = color.new(color.green, 0), style = plot.style_linebr)

plot(signalDirection, "Signal Direction", display = display.none)
plot(signalScore,     "Signal Score",     display = display.none)
plot(entryLong,       "Entry Long",       display = display.none)
plot(entryShort,      "Entry Short",      display = display.none)
plot(longStop,        "Long Stop",        display = display.none)
plot(longTake,        "Long Take",        display = display.none)
plot(shortStop,       "Short Stop",       display = display.none)
plot(shortTake,       "Short Take",       display = display.none)

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Structure labels (HH / HL / LH / LL)
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
colorBull = #16a34a
colorBear = #dc2626
colorWarn = #1565c0

if showPivots and _phFound and lhDetected
    label.new(bar_index - pivLen, high[pivLen], "LH",
         style = label.style_label_down, color = color.new(colorBear, 30),
         textcolor = color.white, size = size.tiny, force_overlay = true)
if showPivots and _phFound and hhDetected
    label.new(bar_index - pivLen, high[pivLen], "HH",
         style = label.style_label_down, color = color.new(colorBull, 30),
         textcolor = color.white, size = size.tiny, force_overlay = true)
if showPivots and _plFound and hlDetected
    label.new(bar_index - pivLen, low[pivLen], "HL",
         style = label.style_label_up, color = color.new(colorBull, 30),
         textcolor = color.white, size = size.tiny, force_overlay = true)
if showPivots and _plFound and llDetected
    label.new(bar_index - pivLen, low[pivLen], "LL",
         style = label.style_label_up, color = color.new(colorBear, 30),
         textcolor = color.white, size = size.tiny, force_overlay = true)

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Signal labels + Outcome tracking
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
var label[] _pendingLbl  = array.new_label()
var int[]   _pendingBar  = array.new_int()
var float[] _pendingRef  = array.new_float()
var bool[]  _pendingLong = array.new_bool()

if showScoreLabel and longSignal
    string structCtx = longPivotFail ? "⚠ Struktur: LL (gegenläufig)" : "✓ Struktur ok"
    string tip = "Qualität: " + f_tier(longQuality) + " (" + str.tostring(longQuality) + "/2)\n"
    tip += "── Pflicht-Gates ──\n"
    tip += (not useGateA or liquiditySweepLong) ? "✓ [A] Sweep\n"            : "✗ [A] Sweep\n"
    tip += (not useGateB or closeInUpperThird)   ? "✓ [B] Close upper ⅓\n"     : "✗ [B] Close upper ⅓\n"
    tip += (not useGateC or bodyOk)              ? "✓ [C] Body size\n"         : "✗ [C] Body size\n"
    tip += (not useGateD or atrOk)               ? "✓ [D] ATR Korridor\n"      : "✗ [D] ATR Korridor\n"
    tip += sweepNotTooDeepLong                   ? "✓ [E] Spike max\n"         : "✗ [E] Spike max\n"
    tip += (not useGateF or not bearTrend)       ? "✓ [F] HTF Trend ok\n"      : "✗ [F] HTF Trend ok\n"
    tip += (not useGateG or wt1_1H <= gateG_os)  ? "✓ [G] 1H WT ok\n"          : "✗ [G] 1H WT ok\n"
    tip += (not useGateH or wt1_4H <= gateH_os)  ? "✓ [H] 4H WT ok\n"          : "✗ [H] 4H WT ok\n"
    tip += "── Optional ──\n"
    tip += rsiValue > 50       ? "✓ RSI > 50 (+1)\n"       : "✗ RSI > 50\n"
    tip += not llDetected      ? "✓ Kein LL (+1)\n"        : "✗ Kein LL\n"
    tip += structCtx
    lbl = label.new(bar_index, low,
         "BUY — " + f_tier(longQuality),
         style     = label.style_label_up,
         textcolor = color.white,
         color     = colorBull,
         tooltip   = tip)
    array.push(_pendingLbl,  lbl)
    array.push(_pendingBar,  bar_index)
    array.push(_pendingRef,  high)
    array.push(_pendingLong, true)

if showScoreLabel and shortSignal
    string structCtx = shortPivotFail ? "⚠ Struktur: HH (gegenläufig)" : "✓ Struktur ok"
    string tip = "Qualität: " + f_tier(shortQuality) + " (" + str.tostring(shortQuality) + "/2)\n"
    tip += "── Pflicht-Gates ──\n"
    tip += (not useGateA or liquiditySweepShort) ? "✓ [A] Sweep\n"            : "✗ [A] Sweep\n"
    tip += (not useGateB or closeInLowerThird)   ? "✓ [B] Close lower ⅓\n"     : "✗ [B] Close lower ⅓\n"
    tip += (not useGateC or bodyOk)              ? "✓ [C] Body size\n"         : "✗ [C] Body size\n"
    tip += (not useGateD or atrOk)               ? "✓ [D] ATR Korridor\n"      : "✗ [D] ATR Korridor\n"
    tip += sweepNotTooDeepShort                  ? "✓ [E] Spike max\n"         : "✗ [E] Spike max\n"
    tip += (not useGateF or not bullTrend)       ? "✓ [F] HTF Trend ok\n"      : "✗ [F] HTF Trend ok\n"
    tip += (not useGateG or wt1_1H >= gateG_ob)  ? "✓ [G] 1H WT ok\n"          : "✗ [G] 1H WT ok\n"
    tip += (not useGateH or wt1_4H >= gateH_ob)  ? "✓ [H] 4H WT ok\n"          : "✗ [H] 4H WT ok\n"
    tip += "── Optional ──\n"
    tip += rsiValue > 50       ? "✓ RSI > 50 (+1)\n"        : "✗ RSI > 50\n"
    tip += not hhDetected      ? "✓ Kein HH (+1)\n"         : "✗ Kein HH\n"
    tip += structCtx
    lbl = label.new(bar_index, high,
         "SELL — " + f_tier(shortQuality),
         style     = label.style_label_down,
         textcolor = color.white,
         color     = colorBear,
         tooltip   = tip)
    array.push(_pendingLbl,  lbl)
    array.push(_pendingBar,  bar_index)
    array.push(_pendingRef,  low)
    array.push(_pendingLong, false)

// Outcome: kein neues Hoch/Tief im Fenster → Label blau
if array.size(_pendingLbl) > 0
    for i = array.size(_pendingLbl) - 1 to 0
        _lbl    = array.get(_pendingLbl,  i)
        _sigBar = array.get(_pendingBar,  i)
        _ref    = array.get(_pendingRef,  i)
        _isLong = array.get(_pendingLong, i)
        if bar_index > _sigBar
            _win     = _isLong ? high > _ref : low < _ref
            _expired = bar_index - _sigBar >= outcomeWindow
            if _win or _expired
                if not _win
                    label.set_color(_lbl, colorWarn)
                array.remove(_pendingLbl,  i)
                array.remove(_pendingBar,  i)
                array.remove(_pendingRef,  i)
                array.remove(_pendingLong, i)

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Backgrounds
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
bgcolor(showTrendBackground and bullTrend ? color.new(color.green,  92) : na)
bgcolor(showTrendBackground and bearTrend ? color.new(color.red,    92) : na)
bgcolor(only15m             and not is15m ? color.new(color.orange, 85) : na)

//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// Alerts
//━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
bool alertsOnBarClose = input.bool(true, "Alerts only on bar close (confirmed)", group="Alerts")
bool alertOk = not alertsOnBarClose or barstate.isconfirmed
alertcondition(alertOk and (longSignal),                title = "BUY Signal",        message = "RES · BUY · {{ticker}} {{interval}} · Px={{close}}")
alertcondition(alertOk and (shortSignal),               title = "SELL Signal",        message = "RES · SELL · {{ticker}} {{interval}} · Px={{close}}")
alertcondition(alertOk and (longSignal or shortSignal),  title = "BUY or SELL Signal", message = "RES · Signal · {{ticker}} {{interval}} · Px={{close}}")

// @strategy-config
// long:      longSignal
// short:     shortSignal
// sl_type:   directional_fixed_tp
// sl_long:   longStop
// sl_short:  shortStop
// tp_long:   longTake
// tp_short:  shortTake
// @end-strategy-config

Overview

Reversal Engine Score v1 [WavesUnchained] looks for a swing high or low violation followed by a recovery close, then grades optional conditions such as RSI and structure into a 0–2 quality score with separate long and short thresholds. Optional gates add body size, an ATR volatility corridor, a spike filter, and higher-timeframe trend from two EMAs, with optional WaveTrend confluence. It can plot structural stop and R-multiple target levels, a score label, and a trend background. By default it runs only on the 15-minute chart and does not place trades.

Details

Published by

casoon on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

SMC / ICT / price action, Oscillators & momentum, Volatility & bands, Support & resistance

Markets

Any symbol

Timeframes

M15-H1

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

pine-scriptpinescripttechnical-analysistrading-indicatorstrading-strategiestradingview

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Nur auf 15M aktivbooltrueonly15m
SL/TP-Level anzeigenbooltrueshowLevels
Trend-HintergrundboolfalseshowTrendBackground
Score am Signal anzeigenbooltrueshowScoreLabel
HandelsrichtungstringBothtradeDir
Min. Qualität Long (0–2)int2minQualityLong
Min. Qualität Short (0–2)int1minQualityShort
RSI Längeint14rsiLen
Gate A — Liquidity SweepbooltrueuseGateA
[A] Sweep Lookbackint10swingLen
Gate B — Close-Position (⅓-Regel)boolfalseuseGateB
Gate C — Body-GrößeboolfalseuseGateC
Show all 40 settings
SettingTypeDefaultVariable
[C] Min. Body / ATRfloat0.25minBodyAtr
Gate D — ATR MinimumbooltrueuseGateD
[D] ATR Längeint14atrLen
[D] ATR Basislängeint50atrBaseLen
[D] Min (× Basis)float0.60atrLowFactor
Gate E — Spike-FilterboolfalseuseGateE
[E] Max Sweep-Tiefe (ATR×)float0.80spikeAtrMult
Gate F — HTF TrendfilterbooltrueuseGateF
[F] Timeframetimeframe60htf
[F] EMA schnellint50htfFastLen
[F] EMA langsamint200htfSlowLen
Gate G — 1H WT ConfluenceboolfalseuseGateG
[G/H] WT Channel Lengthint10wtChLen
[G/H] WT Average Lengthint21wtAvgLen
[G] 1H OS Threshold (long)float-30.0gateG_os
[G] 1H OB Threshold (short)float30.0gateG_ob
Gate H — 4H WT ConfluenceboolfalseuseGateH
[H] 4H OS Threshold (long)float-30.0gateH_os
[H] 4H OB Threshold (short)float30.0gateH_ob
Gate I — Session-FilterboolfalseuseGateI
[I] Session (Börsenzeit)session0700-1200sessionInput
Längeint21emaLen
TypstringEMAsmoothType
JMA Phaseint50jmaPhase
JMA Powerfloat2.0jmaPower
SL Puffer (ATR×)float0.30slAtrBuffer
TP Risk-Multiplefloat1.50tpRMult
Cooldown nach Signalint5sigCooldown
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

ICT Liquidity Void Fill

by ArunKBhaskar
575 stars

This overlay indicator marks ICT liquidity void fills on the price chart and can show long and short signals. It places a Fibonacci level inside a displacement candle, defaulting to the midpoint, and draws lines in a chosen style. Optional filters limit the fi

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Liquidity Void Fill
218 stars

This indicator maps market structure and supply and demand zones on the price chart. It marks validated and optional unvalidated swing highs and lows using a pivot length and extra confirmation bars. Consolidation and impulse moves are measured against ATR to

Indicator v6 SMC / ICT / price actionSupport & resistance Repaints
Updated 3 months ago · None stated GitHub repository of Market Structure + Supply/Demand
55 stars

This Pine Script indicator overlays institutional liquidity levels on the price chart. It identifies order block levels using pivot highs and lows, then draws mean reversion lines from the 20 and 50 period simple moving averages, a volatility range midpoint pr

Indicator v6 Support & resistanceSMC / ICT / price action Repaints
Updated 6 months ago · Apache-2.0 GitHub repository of AAPL Institutional Liquidity Grid

This indicator combines six trading tools into a single chart overlay to optimize indicator limits. It calculates Bollinger Bands, projects weekend price boundaries, plots market structure elements like order blocks, breaker blocks, and MSB lines, marks New Yo

Indicator v6 Support & resistanceSMC / ICT / price action Repaints

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers