OPEN-SOURCE SCRIPT

GMMA ABC Signal

74
Goal (one-liner)

Detect trend-aligned entries using an 18-EMA GMMA stack, then filter out chop with momentum (ATR), trend strength (ADX/RSI), and a tight-range (“box”) mute. Auto-draw SL/TP and fire alerts.

1) Core inputs & idea

Three entry archetypes

Type A (Structure break in a tight bundle): GMMA is narrow → price breaks prior swing with correct bull/bear sequence.

Type B (Trend continuation): Price crosses many EMAs with body and short>mid (bull) or short<mid (bear); strengthened by spread, ADX/RSI.

Type C (Momentum burst): Many crosses happen with large candle body (own ATR gate).

Execution guardrails

confirmClose: confirm on bar close.

cooldownBars: throttle back-to-back signals.

Global box filter: mute signals inside a tight range.

2) The 18-EMA GMMA backbone

Short: 3,5,8,10,12,15; Mid: 30,35,40,45,50,60; Long: 100,125,150,175,200,250.

Compute min/max/averages of each band to measure:

Spread = (max EMA − min EMA) / close → how “bundled” or “fanned-out” the GMMA is.

Sequence:

Bull (loose): minLong < minMid < minShort (shorts sit above mids above longs)

Bear (loose): maxShort < maxMid < maxLong

Strict (optional): no overlaps (clean stacking).

3) Candle power & patterns

Body power: body ≥ ATR(14) * atrMult (global switch).

Optional fast-pass patterns (OR with body): Pin bar, Engulfing, Marubozu (bull/bear versions).
→ If any passes, the candle is considered “valid” even if body is smaller (when enabled).

4) Cross counts (the “how many EMAs did we clear?” part)

For each EMA, count if price closed above after touching from below (crossUp) or closed below after touching from above (crossDown).

Also count body-colored crosses (crossBodyUp/Down) to emphasize directional conviction.

5) Type-specific logic (with anti-chop filters)
Type A — tight bundle + structure break + sequence

Long: spreadPct < spreadThresh AND bull sequence AND brokeUp AND candle pass.

Short: symmetric with bear sequence and brokeDn.

Type B — continuation, reinforced

Base rules:

Long: green body, crossBodyUp ≥ bodyThresh, shortAvg > midAvg, close > longAvg, candle pass.

Short: red body, crossBodyDown ≥ bodyThresh, shortAvg < midAvg, close < longAvg, candle pass.

Anti-chop add-ons:

Require GMMA spread ≥ minSpreadB (trend sufficiently expanded).

ADX/RSI gate (configurable AND/OR and individual enable flags):

ADX ≥ adxMin_B

RSI ≥ rsiMinLong_B (long) or RSI ≤ rsiMaxShort_B (short)

Type C — momentum pop

Needs many crosses (crossUp / crossDown ≥ crossThresh) and a strong candle.

Has its own ATR body threshold: body ≥ ATR * atrMultC (separate from global).

6) Global “Box” (tight-range) mute

Look back boxLookback bars; if (highest−lowest)/close ≤ boxMaxPct, then mute all signals.

Prevents trading inside cramped ranges.

7) Signal priority + confirmation + cooldown

Compute raw A/B/C booleans.

Pick first valid in order A → B → C per side (long/short).

Apply:

Bar confirmation (confirmClose)

Cooldown (no new signal within cooldownBars after last)

Global box mute

Record bar index to enforce cooldown.

8) SL/TP logic (simple R-based scaffolding)

SL: previous swing extreme within structLookback (long uses prevLow, short uses prevHigh).

Risk R: distance from entry close to SL (min-tick protected).

TPs: TP1/TP2/TP3 = close ± R × (tp1R, tp2R, tp3R) depending on side.

On a new signal, draw lines for SL/TP1/TP2/TP3; keep them for keepBars then auto-delete.

9) Visuals & alerts

Plot labels for raw Type A/B/C (so you can see which bucket fired).

Entry label on the chosen signal with SL/TP prices.

Alerts: "ABC LONG/SHORT Entry" with ticker & timeframe placeholders.

10) Info panel (top-right)

Shows spread%, box%, ADX, RSI on the last/confirmed bar for quick situational awareness.

11) How to tune (quick heuristics)

Too many signals? Increase minSpreadB, adxMin_B, bodyThresh, or enable confirmClose and a small cooldownBars.

Missing breakouts? Lower atrMultC (Type C) or crossThresh; relax minSpreadB.

Choppy pairs/timeframes? Raise boxMaxPct sensitivity (smaller value mutes more), or raise atrMult (global) to demand fatter candles.

Cleaner trends only? Turn on strictSeq for Type A; raise minSpreadB and adxMin_B.

12) Mental model (TL;DR)

A = “Tight coil + fresh structure break”

B = “Established trend, strong continuation” (spread + ADX/RSI keep you out of chop)

C = “Momentum burst through many EMAs” (independent ATR gate)

Then add box mute, close confirmation, cooldown, and auto SL/TP scaffolding.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.