Zen MIG Reversal is a price action overlay indicator that identifies potential reversal setups using three-bar candlestick sequences, gap rules, and moving average filters.
//@version=5
indicator(title="Zen MIG Reversal v2.0 · 20260923", shorttitle="Zen MIG Reversal", overlay=true, max_boxes_count=500)
// =====================================================
// Moving Average
// =====================================================
maType = input.string("EMA", title="MA Type", options=["SMA", "EMA", "SMMA (RMA)", "WMA", "VWMA"], group="Moving Average")
maLength = input.int(20, title="MA Length", minval=1, group="Moving Average")
showMA = input.bool(true, title="Show MA Line", group="Moving Average")
ma(source, length, type) =>
switch type
"SMA" => ta.sma(source, length)
"EMA" => ta.ema(source, length)
"SMMA (RMA)" => ta.rma(source, length)
"WMA" => ta.wma(source, length)
"VWMA" => ta.vwma(source, length)
maLine = ma(close, maLength, maType)
plot(showMA ? maLine : na, title="MA", color=color.blue)
// =====================================================
// Signal Settings
// =====================================================
gapMode = input.string("Micro gap (Brooks)", title="Gap Rule", options=["Micro gap (Brooks)", "Visible gap (strict)"], group="Signal")
maTest = input.string("Tail beyond MA", title="MA Test", options=["Tail beyond MA", "Close beyond MA", "Whole bar beyond MA"], group="Signal")
confirmOnly = input.bool(true, title="Signal on bar close only", group="Signal")
// =====================================================
// Display
// =====================================================
showArrows = input.bool(true, title="Show Arrows", group="Display")
showBoxes = input.bool(true, title="Show Gap Boxes", group="Display")
bullCol = input.color(color.blue, title="Bull Colour", group="Display")
bearCol = input.color(color.red, title="Bear Colour", group="Display")
// =====================================================
// Logic
// =====================================================
isBull(i) => close[i] > open[i]
isBear(i) => close[i] < open[i]
bullBars = isBull(0) and isBull(1) and isBull(2)
bearBars = isBear(0) and isBear(1) and isBear(2)
bullGap = gapMode == "Visible gap (strict)" ? (low > high[2] and low[1] > high[2]) : low > high[2]
bearGap = gapMode == "Visible gap (strict)" ? (high < low[2] and high[1] < low[2]) : high < low[2]
bullMA = maTest == "Close beyond MA" ? close < maLine : maTest == "Whole bar beyond MA" ? high < maLine : low < maLine
bearMA = maTest == "Close beyond MA" ? close > maLine : maTest == "Whole bar beyond MA" ? low > maLine : high > maLine
confirmed = not confirmOnly or barstate.isconfirmed
bullReversal = bullBars and bullGap and bullMA and confirmed
bearReversal = bearBars and bearGap and bearMA and confirmed
// =====================================================
// Drawing
// =====================================================
if bullReversal and showBoxes
box.new(left=bar_index[2], right=bar_index, top=low, bottom=high[2], border_color=bullCol, bgcolor=color.new(bullCol, 80))
if bearReversal and showBoxes
box.new(left=bar_index[2], right=bar_index, top=low[2], bottom=high, border_color=bearCol, bgcolor=color.new(bearCol, 80))
plotshape(showArrows and bullReversal, title="Bull Arrow", style=shape.arrowup, location=location.belowbar, color=bullCol, size=size.small)
plotshape(showArrows and bearReversal, title="Bear Arrow", style=shape.arrowdown, location=location.abovebar, color=bearCol, size=size.small)
// =====================================================
// Alerts
// =====================================================
alertcondition(bullReversal, title="Bull MIG Reversal", message="Bull MIG Reversal — {{ticker}} {{interval}} @ {{close}}")
alertcondition(bearReversal, title="Bear MIG Reversal", message="Bear MIG Reversal — {{ticker}} {{interval}} @ {{close}}")
alertcondition(bullReversal or bearReversal, title="Any MIG Reversal", message="MIG Reversal — {{ticker}} {{interval}} @ {{close}}")
Overview
Zen MIG Reversal checks for consecutive directional bars combined with either Al Brooks micro gaps or strict visible gaps relative to a moving average line. When valid conditions occur, the script draws colored gap boxes and plots signal arrows directly on the price chart. Key settings allow customization of moving average types, gap modes, testing conditions, and bar close confirmation.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
MA Type
string
EMA
maType
MA Length
int
20
maLength
Show MA Line
bool
true
showMA
Gap Rule
string
Micro gap (Brooks)
gapMode
MA Test
string
Tail beyond MA
maTest
Signal on bar close only
bool
true
confirmOnly
Show Arrows
bool
true
showArrows
Show Gap Boxes
bool
true
showBoxes
Bull Colour
color
color.blue
bullCol
Bear Colour
color
color.red
bearCol
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.
This indicator identifies candlestick patterns on the price chart by combining price action with momentum factors and trend filters. It calculates one of four selectable oscillators: Karobein Oscillator, Money Flow Index, RSI, or Stochastic, alongside trend ru
This indicator overlays on the price chart and provides trend and momentum analysis. It calculates and plots three exponential moving averages with fixed periods of 20, 50, and 200 using yellow, orange, and blue colors respectively. The script also computes th
This overlay indicator marks a bearish hanging man candlestick on the price chart. It looks for a small real body sitting in the upper part of the range, a lower shadow at least twice the body, and no upper shadow, and only while an uptrend filter is active. T
This indicator plots Bollinger Bands and smoothed HAMA candles on the price chart. It builds each candle from separate moving averages of open, high, low and close, using selectable EMA, SMA or WMA lengths. A simple moving average forms the band basis, and an
Calculates adaptive arithmetic candles by blending price data with Kaufman Efficiency Ratio smoothing and a linear regression anchor. It measures trend health using a zero-to-hundred Quality Score derived from market efficiency, regression slope, and normalize
This indicator plots 20-period and 200-period Simple Moving Averages on the main price chart while requesting multi-timeframe state data from a higher timeframe. It measures the percentage distance and slope between the two moving averages to detect narrow, pa