Classified Alpha Artifact Detected

GEOMETRIC MOMENTUM

An elite proprietary Pine Script v6 oscillator engineered for institutional volatility displacement and reversal precision.

CLICK TO DECRYPT
GMO v6 QUANTUM MOMENTUM ENGINE
LEGENDARY ARTIFACT UNLOCKED

Geometric Momentum Oscillator (GMO)

A precision indicator that evaluates outlier rate-of-change (OROC), weighted median baselines, and 3-filter zone triggers to uncover high-probability institutional reversal zones.

TUTORIAL & TUNING
geometric_momentum_oscillator_v6.pine
//@version=6
indicator(title="Geometric Momentum Oscillator", shorttitle="GMO", precision=2, overlay=false)

// ── INPUTS ─────────────────────────────────────────────
rocLen                  = input.int(1, "Framing: ROC", tooltip="This is the length for the currently calculated rate of change...")
baseLen                 = input.int(50, "Avg. ROC", tooltip="This is the length for calculating the average ROC...")
medianLen               = input.int(20, "Framing: Median", tooltip="This is the length of the rolling window for calculating the weighted median...")
useMasterLen            = input.bool(false, "Enable GMO Length", tooltip="Enable rolling window for the main GMO line.")
masterLen               = input.int(50, "Framing: GMO", tooltip="Length of the rolling window for the main GMO line.")

// ── 1. CORE GLOBAL & ROLLING GMO CALCULATION ───────────
var float globalHi      = -1e10
var float globalLo      = 1e10

globalHi               := math.max(globalHi, high)
globalLo               := math.min(globalLo, low)

rollingHi               = ta.highest(high, masterLen)
rollingLo               = ta.lowest(low, masterLen)

spanHi                  = useMasterLen ? rollingHi : globalHi
spanLo                  = useMasterLen ? rollingLo : globalLo

rangeSpan               = spanHi - spanLo
gmo                     = rangeSpan != 0 ? ((close - spanLo) / rangeSpan) * 200 - 100 : 0.0

// ── 2. OUTLIER-ROC (OROC) CALCULATION ON THE GMO ───────
rawRoc                  = ta.change(gmo, rocLen) / nz(gmo[rocLen], 1.0)
posRoc                  = math.max(rawRoc, 0.0)
negRoc                  = math.min(rawRoc, 0.0)
avgPosRoc               = ta.sma(posRoc, baseLen)
avgNegRoc               = ta.sma(negRoc, baseLen)
orocPos                 = math.max(0.0, posRoc - avgPosRoc)
orocNeg                 = math.max(0.0, math.abs(negRoc) - math.abs(avgNegRoc))
orocWeight              = orocPos + orocNeg + 0.00001

// ── 3. OPTIMIZED WEIGHTED MEDIAN CALCULATION (NATIVE) ──
f_weightedMedian(val, wt, length) =>
    var float[] vals = array.new_float(0)
    var float[] wts  = array.new_float(0)
    array.push(vals, val)
    array.push(wts, wt)
    if array.size(vals) > length
        array.shift(vals)
        array.shift(wts)
    int size = array.size(vals)
    float result = val
    if size >= length
        int[] sortedIndices = array.sort_indices(vals)
        float totalWeight = 0.0
        for i = 0 to size - 1
            totalWeight += array.get(wts, array.get(sortedIndices, i))
        float halfWeight = totalWeight / 2.0
        float cumWeight = 0.0
        int medianIdx = array.get(sortedIndices, 0)
        for i = 0 to size - 1
            int idx = array.get(sortedIndices, i)
            cumWeight += array.get(wts, idx)
            if cumWeight >= halfWeight
                medianIdx := idx
                break
        result := array.get(vals, medianIdx)
    result

gmoStandardRate = f_weightedMedian(gmo, orocWeight, medianLen)

// ── 4. 3-FILTER ZONE TRIGGERS ──────────────────────────
bool isDownBar          = close < open
bool isUpBar            = close > open
bool isSellScaling      = (gmo > 50) and (gmo > gmoStandardRate) and isUpBar
bool isBuyScaling       = (gmo < -50) and (gmo < gmoStandardRate) and isDownBar

color c_grey            = color.new(#808080, 40)
color c_red             = color.new(#f23645, 20)
color c_blue            = color.new(#2962ff, 20)
color c_teal            = color.new(#089981, 18)
color lineCol           = c_grey

hline(100, "MAXIMUM", color=color.new(#808080, 96))
hline(50, "MAXIMA", color=color.new(#808080, 72))
hline(0, "CENTERLINE", color=color.new(#808080, 100))
hline(-50, "MINIMA", color=color.new(#808080, 72))
hline(-100, "MINIMUM", color=color.new(#808080, 96))

plot(gmo, title="GMO Line", color=lineCol, linewidth=2)
plot(gmoStandardRate, title="Standard Rate", color=c_teal, linewidth=1)
bgcolor(isSellScaling ? color.new(c_red, 80) : isBuyScaling ? color.new(c_blue, 80) : na)