OPEN-SOURCE SCRIPT

Mongoose Compass v2 — Regime & Position Sizing

38
What it does

Mongoose Compass v2 is a regime‐detection dashboard and optional price-chart ribbon. It combines four market “pillars” into a 0–4 score and a suggested equity beta/position size. It is scale-independent and works on any host symbol.

Pillars (green = expansion supportive):

RS IWM/SPY – small-cap relative strength vs large caps

Credit HYG/LQD – high-yield vs investment-grade credit

Growth Cu/Au – copper vs gold (cyclical demand vs safety)

Participation – uses the first available of:

Breadth (% > 200-DMA) if you provide a symbol, else

Cboe S&P 500 Dispersion (DSPX), else

RSP/SPY equal-weight proxy

Score (0–4):

≥ 3 = Expansion

2 = Neutral

≤ 1 = Contraction

A panel shows each pillar’s normalized value (0–100), bias, total score, and a suggested size (default mapping: 0/30/60/90/100% for scores 0–4). The companion “Ribbon” script paints the price chart background by regime and displays the suggested size.

How to use

Timeframes

Weekly for regime calls (recommended anchor).

Daily for execution within the active regime (adds, trims, hedges).

Playbook

Expansion (score ≥ 3): increase risk/beta; favor cyclicals, small caps, EM; reduce hedges.

Neutral (score = 2): keep moderate beta; use relative value (e.g., quality/mega vs small caps) until RS or Cu/Au turns.

Contraction (score ≤ 1): de-risk; rotate to defensives/quality, gold/long duration; add hedges.

Alerts (included):

Expansion Regime (score ≥ 3) – risk-on trigger

Contraction Regime (score ≤ 1) – risk-off trigger

Methodology

Prices are pulled with request.security on the chosen timeframe.

Pillars are built from ratios then smoothed with an SMA (Smoothing Length, default 20).

For display/comparison, series are normalized to 0–100 within a rolling window (Normalization Length, default 60).

Bias rules:

RS / Credit / Growth: fast SMA( len ) vs slow SMA( len*2 ) of each ratio

Breadth: normalized value > 60

DSPX: normalized value < 40 (lower dispersion supports index coherence)

RSP/SPY proxy: fast > slow trend test

Score is the count of green pillars (0–4).

Suggested size is a deterministic mapping from score (editable in settings).

Notes:

Host chart scaling (log vs linear) does not affect calculations.

If a breadth series is unavailable, the script automatically falls back to DSPX, then to RSP/SPY.

Settings

Sources

Default inputs use liquid ETFs (BATS/AMEX). You may switch Copper/Gold to futures (e.g., COMEX_DL:HG1!, COMEX_DL:GC1!) if your data plan supports them.

Optional Breadth: paste a percent-above-MA series if you have one.

DSPX: uses CBOE:DSPX when breadth is blank.

If neither breadth nor DSPX resolve, the script uses RSP/SPY as a participation proxy.

Calculation

Smoothing Length (20) – higher = steadier regime, fewer flips; lower = faster reaction.

Normalization Length (60) – window for the 0–100 scaling; increase to reduce pinning at extremes.

Regime Timeframe (Ribbon only) – lock the ribbon to Weekly while viewing Daily charts.

Visual

Show/hide dashboard table, choose table position, dark/light theme, ribbon opacity.

Recommended usage

Anchor decisions on Weekly Compass; use Daily for timing.

For small-cap rotation, apply on IWM/RTY; for broad beta, use SPY/ES. Output is identical regardless of host symbol because inputs are fetched internally.

Limitations & disclaimer

This is a systematic information tool, not investment advice.

Signals can whipsaw in fast markets; confirm with your risk framework.

Data availability varies by plan (especially futures and DSPX). When a source is unavailable the scripted fallbacks apply automatically.

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.