Indicator · Pine Script v6 · Own pane

MFI Advanced [WavesUnchained]

by casoon

MFI Advanced is a separate pane volume-and-momentum oscillator that enhances the traditional Money Flow Index with pluggable smoothing options such as JMA, KAMA, and SuperSmoother.

View on GitHub

GitHub stars9on the repository
Pine versionv6current
Lines of code417
Settings36inputs
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

417 lines of Pine Script v6 from indicators/money_flow/mfi_advanced/mfi_advanced.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

mfi_advanced.pine
//@version=6
// ============================================================================
// MFI Advanced [WavesUnchained]
// Version: 1.3.4
// Author: WavesUnchained
// Build: 2026-10-12
// ============================================================================
// Money Flow Index with trend context, stall/absorption, conviction markers,
// and directional long/short coloring on a bounded 0-100 oscillator core.
//
// Features:
//   ✓ Manual MFI core with pluggable smoothing
//   ✓ Bounded 0-100 panel with 50 midline and 80/20 OB/OS zones
//   ✓ Stall/absorption context: marks crosses contradicted by flat price as weak
//   ✓ Trend context line (slow MFI): support the fast line rests on
//   ✓ Trend↔MFI divergence wedge: fast and trend move opposite
//   ✓ Long/Short coloring for trend context, histogram, and divergence wedge
//   ✓ Sentiment Bar — live ±100 OB/OS extremity score + mini bar
//   ✓ Signal Quality — optional 0-100 conviction score per Bull/Bear cross
//   ✓ Gradient line color, shadow fills, OB/OS zone fills, and alerts
//
// Data Contract:
//   Price:     REQUIRED   chart symbol
//   Volume:    REQUIRED   real trade volume — feed must deliver volume and
//                         syminfo.volumetype must not be "tick"; otherwise not available
//   OI:        NO
//   Reference: NO
//   Verdict:   Exchange-only
//
// ============================================================================

indicator("MFI Advanced [WavesUnchained]", "MFI·ADV", format=format.price, precision=2, overlay=false, max_labels_count=500)

// ─────────────────────────────────────────────────────────────────────────────
// INPUTS
// ─────────────────────────────────────────────────────────────────────────────

g_core = "1 · Core"
src    = input.source(hlc3, "Source",         group=g_core)
mfiLen = input.int(14,      "MFI Length",     minval=1, group=g_core)
avgLen = input.int(3,       "Average Length", minval=1, group=g_core)
sigLen = input.int(9,       "Signal Length",  minval=1, group=g_core)
smoothType = input.string("EMA", "Smoothing Type",
     options=["EMA", "SMA", "RMA", "WMA", "SuperSmoother", "T3", "KAMA", "JMA Approx"],
     group=g_core)
jmaPhase = input.int(50,    "  JMA Phase", minval=-100, maxval=100,             group=g_core)
jmaPower = input.float(2.0, "  JMA Power", minval=1.0,  maxval=4.0, step=0.25, group=g_core)

g_levels = "2 · Mid / Levels"
midLine = input.float(50, "Midline",    minval=0,  maxval=100, group=g_levels)
obLevel = input.float(80, "Overbought", minval=50, maxval=100, group=g_levels)
osLevel = input.float(20, "Oversold",   minval=0,  maxval=50,  group=g_levels)

g_stall = "3 · Stall / Absorption"
useStall     = input.bool(true, "Detect Stall (MFI moves, price holds)", group=g_stall,
     tooltip="Flags bars where MFI cools/heats sharply but price barely moves. Annotates crosses and fades the histogram; never changes the cross logic itself.")
stallLen     = input.int(5,     "Stall Lookback (bars)", minval=1, group=g_stall)
stallFlatATR = input.float(0.5, "Max Price Move (ATR)",  minval=0.0, step=0.1, group=g_stall)
stallMfiMin  = input.float(15,  "Min MFI Move",          minval=0,   step=1,   group=g_stall)

g_ctx = "4 · Trend Context"
useCtx = input.bool(true, "Show Trend Context Line", group=g_ctx,
     tooltip="A slow MFI plotted faint behind the fast line. While it holds its side of 50, an opposite fast cross is treated as counter-trend.")
ctxLen = input.int(100, "Trend MFI Length", minval=2, group=g_ctx)

g_conv = "5 · Conviction"
useExtremeOnly  = input.bool(true, "Extreme Signals: require OB/OS zone", group=g_conv)
lookbackExtreme = input.int(5,     "OB/OS Lookback (bars)",               minval=1, group=g_conv)
showMidCross    = input.bool(true, "Show 50-Cross Markers",               group=g_conv)

g_div = "6 · Divergence"
showDiv = input.bool(true, "Highlight Trend ↔ MFI Divergence", group=g_div,
     tooltip="Fills the wedge between fast MFI and the trend context line only when they move in opposite directions.")
divLen  = input.int(4,    "Divergence Slope Lookback", minval=1, group=g_div)
divMin  = input.float(10, "Min Fast Slope",            minval=0, step=1, group=g_div)

g_plots = "7 · Plots"
showShadow   = input.bool(true,  "Shadow Fill (MFI vs 50)", group=g_plots)
showFill     = input.bool(true,  "Fill MFI / Signal",       group=g_plots)
showZoneFill = input.bool(true,  "Fill OB / OS Zones",      group=g_plots)
showHist     = input.bool(true,  "Show Histogram",          group=g_plots)
showSignals  = input.bool(true,  "Show Signal Markers",     group=g_plots)

g_col = "7 · Plots · Colors"
colBull   = input.color(#00bcd4,                "Bull (level)",           group=g_col)
colBear   = input.color(#f06292,                "Bear (level)",           group=g_col)
colLong   = input.color(#00c853,                "Long (trend/momentum)",  group=g_col)
colShort  = input.color(#d50000,                "Short (trend/momentum)", group=g_col)
colZoneOB = input.color(color.new(#f06292, 90), "OB Zone Fill",           group=g_col)
colZoneOS = input.color(color.new(#00bcd4, 90), "OS Zone Fill",           group=g_col)

g_score = "8 · Score"
showSentiment = input.bool(true,  "Show Sentiment Bar", group=g_score,
     tooltip="Live label at the panel's right edge — how far MFI sits inside its own OB/OS zone, signed ±100. Not a fixed Bullish/Bearish claim. Mirrors Williams VIX Fix Advanced's Sentiment Bar.")
showQuality   = input.bool(false, "Show Signal Quality Labels", group=g_score,
     tooltip="Adds a 0-100 quality score next to each Bull/Bear Extreme marker: 50% OB/OS-zone depth + 25% context agreement + 25% stall-free. Mirrors Williams VIX Fix Advanced's Spike Quality.")

// ─────────────────────────────────────────────────────────────────────────────
// DATA VALIDITY
// ─────────────────────────────────────────────────────────────────────────────

// Echtes Handelsvolumen? Nur "tick" schließt es ausdrücklich aus (Anzahl
// Transaktionen, keine Menge). "n/a" heißt laut Referenz "kein Volumen ODER Art
// nicht angegeben" — die meisten Feeds außer Krypto melden das, auch Futures mit
// echten Kontrakten. Dort entscheidet, ob der Feed überhaupt Volumen liefert.
var bool feedHasVolume = false
if nz(volume) > 0
    feedHasVolume := true
bool volumeIsReal = syminfo.volumetype != "tick" and feedHasVolume

float vol = volumeIsReal ? volume : na

// ─────────────────────────────────────────────────────────────────────────────
// SMOOTHING FUNCTIONS
// ─────────────────────────────────────────────────────────────────────────────

f_supersmoother(series float x, simple int len) =>
    float pi = math.pi
    float a1 = math.exp(-1.414 * pi / len)
    float b1 = 2.0 * a1 * math.cos(1.414 * pi / len)
    float c2 = b1
    float c3 = -(a1 * a1)
    float c1 = 1.0 - c2 - c3
    var float ss = na
    ss := c1 * (x + nz(x[1])) / 2.0 + c2 * nz(ss[1]) + c3 * nz(ss[2])
    ss

f_t3(series float x, simple int len) =>
    float b  = 0.7
    float e1 = ta.ema(x, len)
    float e2 = ta.ema(e1, len)
    float e3 = ta.ema(e2, len)
    float e4 = ta.ema(e3, len)
    float e5 = ta.ema(e4, len)
    float e6 = ta.ema(e5, len)
    float c1 = -(b * b * b)
    float c2 =  3.0 * b * b + 3.0 * b * b * b
    float c3 = -6.0 * b * b - 3.0 * b - 3.0 * b * b * b
    float c4 =  1.0 + 3.0 * b + b * b * b + 3.0 * b * b
    c1 * e6 + c2 * e5 + c3 * e4 + c4 * e3

f_kama(series float x, simple int len) =>
    float change   = math.abs(x - x[len])
    float vol      = math.sum(math.abs(x - x[1]), len)
    float er       = vol != 0.0 ? change / vol : 0.0
    float sc       = math.pow(er * (2.0 / 3.0 - 2.0 / 31.0) + 2.0 / 31.0, 2)
    var float kama = na
    kama := nz(kama[1], x) + sc * (x - nz(kama[1], x))
    kama

f_jma(series float x, simple int len, simple int phase, simple float power) =>
    var float jma = na
    var float e0  = na
    var float e1  = na
    var float e2  = na
    float phaseRatio = phase < -100 ? 0.5 : phase > 100 ? 2.5 : phase / 100.0 + 1.5
    float beta       = 0.45 * (len - 1) / (0.45 * (len - 1) + 2.0)
    float alpha      = math.pow(beta, power)
    e0  := (1.0 - alpha) * x + alpha * nz(e0[1], x)
    e1  := (x - e0) * (1.0 - beta) + beta * nz(e1[1], 0.0)
    e2  := (e0 + phaseRatio * e1 - nz(jma[1], x)) * math.pow(1.0 - alpha, 2.0) + math.pow(alpha, 2.0) * nz(e2[1], 0.0)
    jma := nz(jma[1], x) + e2
    jma

f_smooth(series float x, simple int len, simple string mode) =>
    switch mode
        "SMA"           => ta.sma(x, len)
        "RMA"           => ta.rma(x, len)
        "WMA"           => ta.wma(x, len)
        "SuperSmoother" => f_supersmoother(x, len)
        "T3"            => f_t3(x, len)
        "KAMA"          => f_kama(x, len)
        "JMA Approx"    => f_jma(x, len, jmaPhase, jmaPower)
        =>                 ta.ema(x, len)

f_mfi(series float x, simple int len) =>
    float rawMoneyFlow = x * vol
    float positiveFlow = x > x[1] ? rawMoneyFlow : 0.0
    float negativeFlow = x < x[1] ? rawMoneyFlow : 0.0
    float positiveSum  = math.sum(positiveFlow, len)
    float negativeSum  = math.sum(negativeFlow, len)
    float totalFlow    = positiveSum + negativeSum
    totalFlow == 0.0 ? 50.0 :
         negativeSum == 0.0 ? 100.0 :
         positiveSum == 0.0 ? 0.0 :
         100.0 - (100.0 / (1.0 + positiveSum / negativeSum))

// ─────────────────────────────────────────────────────────────────────────────
// MFI CORE
// ─────────────────────────────────────────────────────────────────────────────

mfiRaw  = f_mfi(src, mfiLen)
mfiLine = f_smooth(mfiRaw,  avgLen, smoothType)
signal  = f_smooth(mfiLine, sigLen, smoothType)
hist    = mfiLine - signal

ctxRaw  = f_mfi(src, ctxLen)
ctxLine = f_smooth(ctxRaw, avgLen, smoothType)

bool hasVolume = math.sum(nz(vol, 0.0), mfiLen) > 0.0

// ─────────────────────────────────────────────────────────────────────────────
// MID / LEVELS
// ─────────────────────────────────────────────────────────────────────────────

wasOversold   = ta.lowest(mfiLine,  lookbackExtreme) <= osLevel
wasOverbought = ta.highest(mfiLine, lookbackExtreme) >= obLevel

// ─────────────────────────────────────────────────────────────────────────────
// STALL / ABSORPTION
// ─────────────────────────────────────────────────────────────────────────────

bullCross    = ta.crossover(mfiLine,  signal)
bearCross    = ta.crossunder(mfiLine, signal)
bullExtreme  = hasVolume and bullCross and (not useExtremeOnly or wasOversold)
bearExtreme  = hasVolume and bearCross and (not useExtremeOnly or wasOverbought)
bullMidCross = hasVolume and ta.crossover(mfiLine,  midLine)
bearMidCross = hasVolume and ta.crossunder(mfiLine, midLine)

float atrRef   = ta.atr(14)
float mfiChg   = mfiLine - mfiLine[stallLen]
float priceChg = atrRef != 0.0 ? (close - close[stallLen]) / atrRef : 0.0
bool  flatPx   = math.abs(priceChg) < stallFlatATR
bool  stallBull = hasVolume and useStall and mfiChg < -stallMfiMin and flatPx
bool  stallBear = hasVolume and useStall and mfiChg >  stallMfiMin and flatPx
bool  stallNow  = stallBull or stallBear

// ─────────────────────────────────────────────────────────────────────────────
// TREND CONTEXT
// ─────────────────────────────────────────────────────────────────────────────

bool ctxBull = ctxLine > midLine
bool ctxBear = ctxLine < midLine
bool bearCounter = useCtx and bearExtreme and ctxBull
bool bullCounter = useCtx and bullExtreme and ctxBear

// ─────────────────────────────────────────────────────────────────────────────
// CONVICTION
// ─────────────────────────────────────────────────────────────────────────────

bool bearStrong = bearExtreme and not (stallBull or bearCounter)
bool bearWeak   = bearExtreme and (stallBull or bearCounter)
bool bullStrong = bullExtreme and not (stallBear or bullCounter)
bool bullWeak   = bullExtreme and (stallBear or bullCounter)

// ─────────────────────────────────────────────────────────────────────────────
// SCORE — Sentiment Bar (live extremity read) and Signal Quality (0-100 per
// cross), same weighting as Williams VIX Fix Advanced's Spike Quality, adapted
// to a single signed line instead of two independent bull/bear formulas.
// ─────────────────────────────────────────────────────────────────────────────

float sentBullPct  = (obLevel - midLine) != 0.0 ? math.max(0.0, mfiLine - midLine) / (obLevel - midLine) * 100.0 : 0.0
float sentBearPct  = (midLine - osLevel) != 0.0 ? math.max(0.0, midLine - mfiLine) / (midLine - osLevel) * 100.0 : 0.0
float sentScore    = math.max(-100.0, math.min(100.0, sentBullPct - sentBearPct))
float sentAbsScore = math.abs(sentScore)

// Depth is normalized over the zone itself (OS level → 0, OB level → 100), so a
// visit to the zone floor/ceiling earns the full 50 points
float bullDepth   = osLevel > 0.0 ? math.min(1.0, math.max(0.0, (osLevel - ta.lowest(mfiLine, lookbackExtreme)) / osLevel)) : 0.0
float bearDepth   = obLevel < 100.0 ? math.min(1.0, math.max(0.0, (ta.highest(mfiLine, lookbackExtreme) - obLevel) / (100.0 - obLevel))) : 0.0
float bullQuality = math.min(100.0, bullDepth * 50.0 + (ctxBull ? 25.0 : 0.0) + (not stallBear ? 25.0 : 0.0))
float bearQuality = math.min(100.0, bearDepth * 50.0 + (ctxBear ? 25.0 : 0.0) + (not stallBull ? 25.0 : 0.0))

// ─────────────────────────────────────────────────────────────────────────────
// DIVERGENCE
// ─────────────────────────────────────────────────────────────────────────────

float fastDir = mfiLine - mfiLine[divLen]
float slowDir = ctxLine - ctxLine[divLen]
bool  divBull = hasVolume and useCtx and showDiv and fastDir < -divMin and slowDir > 0.0
bool  divBear = hasVolume and useCtx and showDiv and fastDir >  divMin and slowDir < 0.0

// ─────────────────────────────────────────────────────────────────────────────
// COLORS
// ─────────────────────────────────────────────────────────────────────────────

color lineCol  = color.from_gradient(mfiLine, osLevel, obLevel, colBull, colBear)
color lineCol2 = color.from_gradient(signal,  osLevel, obLevel, color.new(colBull, 40), color.new(colBear, 40))
color ctxCol   = ctxLine >= midLine ? color.new(colLong, 55) : color.new(colShort, 55)

histRising = hist >= hist[1]
histColor  = hist >= 0.0
     ? (histRising     ? colLong  : color.new(colLong, 55))
     : (not histRising ? colShort : color.new(colShort, 55))

// ─────────────────────────────────────────────────────────────────────────────
// HLINES + ZONE FILLS
// ─────────────────────────────────────────────────────────────────────────────

hTop = hline(100, "Top", color=color.new(color.gray, 85))
hMid = hline(midLine, "50", color=color.new(color.gray, 60), linestyle=hline.style_dotted, linewidth=1)
hBot = hline(0, "Bottom", color=color.new(color.gray, 85))
hOB  = hline(obLevel, "Overbought", color=color.new(color.red, 65), linestyle=hline.style_dashed, linewidth=1)
hOS  = hline(osLevel, "Oversold",   color=color.new(#00bcd4, 65),   linestyle=hline.style_dashed, linewidth=1)

fill(hOB, hTop, color=showZoneFill ? colZoneOB : na, title="OB Zone")
fill(hBot, hOS, color=showZoneFill ? colZoneOS : na, title="OS Zone")

// ─────────────────────────────────────────────────────────────────────────────
// PLOTS
// ─────────────────────────────────────────────────────────────────────────────

color histColorFinal = stallNow ? color.new(histColor, 78) : histColor
plot(showHist ? hist : na, "Histogram", style=plot.style_columns, color=histColorFinal)

pMid = plot(midLine, display=display.none)
pCtx = plot(useCtx ? ctxLine : na, "Trend Context", color=ctxCol, linewidth=2)
pSig = plot(signal,  "MFI Signal", color=lineCol2, linewidth=1)
pMFI = plot(mfiLine, "MFI",        color=lineCol,  linewidth=2)

fill(pMFI, pCtx, color=divBull ? color.new(colLong, 80) : divBear ? color.new(colShort, 80) : na,
     title="Trend Divergence")

fill(pMFI, pMid, obLevel, midLine, color.new(colBear, 78), color.new(colBear, 100),
     title="Bear Shadow", display=showShadow ? display.all : display.none)
fill(pMFI, pMid, midLine, osLevel, color.new(colBull, 100), color.new(colBull, 78),
     title="Bull Shadow", display=showShadow ? display.all : display.none)

fill(pMFI, pSig,
     color=showFill ? (mfiLine >= signal ? color.new(colBull, 88) : color.new(colBear, 88)) : na,
     title="MFI Fill")

// ─────────────────────────────────────────────────────────────────────────────
// SIGNAL MARKERS
// ─────────────────────────────────────────────────────────────────────────────

plotshape(showSignals and bullStrong, "Bull Extreme",
     style=shape.triangleup, location=location.bottom,
     color=colBull, size=size.small)

plotshape(showSignals and bullWeak, "Bull Extreme (absorbed)",
     style=shape.triangleup, location=location.bottom,
     color=color.new(colBull, 65), size=size.tiny)

plotshape(showSignals and bearStrong, "Bear Extreme",
     style=shape.triangledown, location=location.top,
     color=colBear, size=size.small)

plotshape(showSignals and bearWeak, "Bear Extreme (absorbed)",
     style=shape.triangledown, location=location.top,
     color=color.new(colBear, 65), size=size.tiny)

plotshape(showSignals and showMidCross and bullMidCross ? mfiLine : na, "Bull 50 Cross",
     style=shape.circle, location=location.absolute,
     color=color.new(colBull, 20), size=size.tiny)

plotshape(showSignals and showMidCross and bearMidCross ? mfiLine : na, "Bear 50 Cross",
     style=shape.circle, location=location.absolute,
     color=color.new(colBear, 20), size=size.tiny)

// ─────────────────────────────────────────────────────────────────────────────
// SCORE DISPLAY — Sentiment Bar (always-on read of current extremity) and
// per-cross Quality labels (why a Strong/Weak marker was graded that way)
// ─────────────────────────────────────────────────────────────────────────────

f_scoreColor(score, absS) =>
    base = score > 0 ? colBear : colBull
    color result = na
    if absS < 15
        result := color.new(color.gray, 40)
    else if absS >= 80
        result := color.new(base, 10)
    else if absS >= 60
        result := color.new(base, 30)
    else if absS >= 40
        result := color.new(base, 50)
    else
        result := color.new(base, 70)
    result

int    scoreBarSegments = 8
int    scoreFilled      = int(math.round(sentAbsScore / 100.0 * scoreBarSegments))
string scoreBarStr      = str.repeat("■", scoreFilled) + str.repeat("·", scoreBarSegments - scoreFilled)
string scoreSignStr     = sentScore > 0 ? "+" : ""
string sentTxt          = scoreSignStr + str.tostring(sentScore, "#") + "  " + scoreBarStr
color  sentColor        = f_scoreColor(sentScore, sentAbsScore)

var label sentLabel = na
if showSentiment and barstate.islast
    label.delete(sentLabel)
    sentLabel := label.new(bar_index + 3, midLine, sentTxt,
         xloc=xloc.bar_index, yloc=yloc.price, style=label.style_label_left,
         color=sentColor, textcolor=color.white, size=size.normal,
         tooltip="How far MFI sits inside its own OB/OS zone: 100×(MFI−midline)/(Overbought−midline) when bullish, 100×(midline−MFI)/(midline−Oversold) when bearish, clamped to ±100. |score| < 15 reads as balanced.")
else if not showSentiment and barstate.islast
    label.delete(sentLabel)

if showQuality and bullExtreme
    label.new(bar_index, mfiLine, str.tostring(bullQuality, "#"),
         style=label.style_label_up, color=bullStrong ? colBull : color.new(colBull, 65), textcolor=color.white, size=size.tiny,
         tooltip="Bull Signal Quality " + str.tostring(bullQuality, "#") + "/100 — OB/OS-zone depth 50% + context agreement 25% + stall-free 25%.")
if showQuality and bearExtreme
    label.new(bar_index, mfiLine, str.tostring(bearQuality, "#"),
         style=label.style_label_down, color=bearStrong ? colBear : color.new(colBear, 65), textcolor=color.white, size=size.tiny,
         tooltip="Bear Signal Quality " + str.tostring(bearQuality, "#") + "/100 — OB/OS-zone depth 50% + context agreement 25% + stall-free 25%.")

// ─────────────────────────────────────────────────────────────────────────────
// DATA VALIDITY WARNING
// ─────────────────────────────────────────────────────────────────────────────

// Kurzer Hinweis unten rechts; was fehlt, steht im Data Contract oben.
var table volWarn = table.new(position.bottom_right, 1, 1)
if barstate.islast and not volumeIsReal
    table.cell(volWarn, 0, 0, "MFI·ADV · not available",
         bgcolor = color.new(color.orange, 20), text_color = color.white, text_size = size.small)

// ─────────────────────────────────────────────────────────────────────────────
// ALERTS
// ─────────────────────────────────────────────────────────────────────────────

bool alertsOnBarClose = input.bool(true, "Alerts only on bar close (confirmed)", group="9 · Alerts")
bool alertOk = not alertsOnBarClose or barstate.isconfirmed

alertcondition(alertOk and bullExtreme,  "MFI Bull Signal",    "MFIA · BULL CROSS OVERSOLD · {{ticker}} {{interval}}")
alertcondition(alertOk and bearExtreme,  "MFI Bear Signal",    "MFIA · BEAR CROSS OVERBOUGHT · {{ticker}} {{interval}}")
alertcondition(alertOk and bullMidCross, "MFI Cross Above 50", "MFIA · CROSS ABOVE 50 · {{ticker}} {{interval}}")
alertcondition(alertOk and bearMidCross, "MFI Cross Below 50", "MFIA · CROSS BELOW 50 · {{ticker}} {{interval}}")

Overview

MFI Advanced [WavesUnchained] plots a smoothed fast MFI line, a signal line, a slow trend context line, and a histogram. The indicator identifies price absorption or stalls by comparing ATR price range against MFI momentum shifts, highlights divergences between fast and context lines, and flags overbought or oversold reversals. Users can adjust smoothing types, lookback periods, stall thresholds, and level definitions. Note that real trade volume data is required.

Details

Published by

casoon on GitHub

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Oscillators & momentum, Volume

Markets

Any symbol

Timeframes

Any timeframe

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
Sourcesourcehlc3src
MFI Lengthint14mfiLen
Average Lengthint3avgLen
Signal Lengthint9sigLen
Smoothing TypestringEMAsmoothType
JMA Phaseint50jmaPhase
JMA Powerfloat2.0jmaPower
Midlinefloat50midLine
Overboughtfloat80obLevel
Oversoldfloat20osLevel
Detect Stall (MFI moves, price holds)booltrueuseStall
Stall Lookback (bars)int5stallLen
Show all 36 settings
SettingTypeDefaultVariable
Max Price Move (ATR)float0.5stallFlatATR
Min MFI Movefloat15stallMfiMin
Show Trend Context LinebooltrueuseCtx
Trend MFI Lengthint100ctxLen
Extreme Signals: require OB/OS zonebooltrueuseExtremeOnly
OB/OS Lookback (bars)int5lookbackExtreme
Show 50-Cross MarkersbooltrueshowMidCross
Highlight Trend ↔ MFI DivergencebooltrueshowDiv
Divergence Slope Lookbackint4divLen
Min Fast Slopefloat10divMin
Shadow Fill (MFI vs 50)booltrueshowShadow
Fill MFI / SignalbooltrueshowFill
Fill OB / OS ZonesbooltrueshowZoneFill
Show HistogrambooltrueshowHist
Show Signal MarkersbooltrueshowSignals
Bull (level)color#00bcd4colBull
Bear (level)color#f06292colBear
Long (trend/momentum)color#00c853colLong
Short (trend/momentum)color#d50000colShort
OB Zone Fillcolorcolor.new(#f06292, 90)colZoneOB
OS Zone Fillcolorcolor.new(#00bcd4, 90)colZoneOS
Show Sentiment BarbooltrueshowSentiment
Show Signal Quality LabelsboolfalseshowQuality
Alerts only on bar close (confirmed)booltruealertsOnBarClose
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

Money Flow Index

by everget
948 stars

Calculates the standard Money Flow Index (MFI) oscillator alongside an exponential moving average signal line in a separate pane. The script visually highlights trend conditions through dynamic ribbon filling, optional difference histogram bars, and overbought

Indicator v4 Oscillators & momentumVolume
Updated 10 days ago · GPL-3.0 GitHub repository of Money Flow Index

Commitment Gauge

by harryguiacorn
219 stars

This indicator measures directional momentum by evaluating candlestick body proportions and volume over a user-defined lookback window. It computes the ratio of candle body to total range, weights the cumulative value by volume and absolute body size, and dete

Indicator v4 VolumeCandlestick patterns
Updated 1 year ago · None stated GitHub repository of Commitment Gauge

Aggregate Signal

by capissimo
114 stars

This indicator builds an aggregate oscillator in a separate pane. It scales open, high, low, close, and volume into a 0 to 1 range, then averages scaled readings from MACD, a MACD histogram, RSI, stochastic, CCI, momentum, OBV, a directional index, volume-weig

Indicator v4 Oscillators & momentumVolume Repaints
Updated 1 year ago · None stated GitHub repository of Aggregate Signal

This indicator calculates the Bill Williams Market Facilitation Index as the high-low range divided by volume, or zero when volume is zero. It compares the index and volume with the previous bar and assigns one of four zones: green for both rising, fade for bo

Indicator v6 VolumeOscillators & momentum
Updated 4 weeks ago · Apache-2.0 GitHub repository of Bill Williams Market Facilitation Index

PPO ATR Bands

by cryptorife
75 stars

PPO ATR Bands plots a percentage price oscillator in a separate pane. It compares a Hull average of typical price with a volume-weighted exponential average of Parabolic SAR, then scales three true-range bands around the slow average into matching oscillator l

Indicator v4 Oscillators & momentumMoving averages
Updated 3 years ago · GPL-3.0 GitHub repository of PPO ATR Bands

Chaikin Oscillator

by be-thomas
65 stars

Calculates the Chaikin Oscillator by taking the difference between a fast exponential moving average and a slow exponential moving average of the Accumulation/Distribution line. It plots the resulting line in a separate pane alongside a dashed zero reference l

Indicator v4 Oscillators & momentumVolume
Updated 4 days ago · GPL-3.0 GitHub repository of Chaikin Oscillator

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