OPEN-SOURCE SCRIPT
Mongoose Compass Ribbon — Regime Overlay & Sizing

What it does
Mongoose Compass Ribbon paints the price chart background by market regime and displays a suggested position size.
It mirrors the Compass panel’s 4-pillar score (0–4) and can lock calculations to Weekly while you view Daily or intraday charts.
Regimes
Expansion: score ≥ 3 (green)
Neutral: score = 2 (orange)
Contraction: score ≤ 1 (red)
Pillars (same as panel):
RS IWM/SPY (small-cap leadership)
Credit HYG/LQD (risk financing)
Growth Copper/Gold (cyclical vs safety)
Participation (first available): Breadth → CBOE:DSPX → RSP/SPY proxy
A floating label shows Score and Suggested size (default ramp: 0/30/60/90/100% for scores 0–4).
How to use
Anchor on Weekly. Keep Regime Timeframe = W so the ribbon shows the higher-timeframe state while you trade on Daily.
Act on flips:
Expansion (≥3): increase beta, reduce hedges.
Neutral (2): keep moderate beta; favor quality/mega vs small caps until RS or Cu/Au turns.
Contraction (≤1): de-risk, rotate defensive, add hedges.
Turn on the built-in alerts: Expansion Regime and Contraction Regime.
Methodology
Prices are fetched via request.security on the selected Regime Timeframe.
Each pillar uses ratio signals smoothed with an SMA (Smoothing Length), and binary rules:
RS / Credit / Growth: fast SMA(len) vs slow SMA(len*2)
Breadth: normalized > 60
DSPX: normalized < 40
RSP/SPY proxy: fast > slow
Score is the count of green pillars (0–4).
Suggested size is a fixed mapping from score (user-editable).
Settings
Sources
Defaults use liquid ETFs (BATS/AMEX). Copper/Gold can be switched to futures if your plan supports them.
Breadth (optional): paste a %>MA symbol if you have one. If blank, the script uses CBOE:DSPX; if DSPX isn’t available it falls back to RSP/SPY.
Calculation
Smoothing Length (20) – higher = steadier regime; lower = faster.
Normalization Length (60) – window for 0–100 scaling in pillar tests.
Regime Timeframe (W) – lock regime to Weekly while viewing lower timeframes.
Visual
Ribbon Opacity controls how strong the background shading is.
Recommended usage
Apply the Ribbon to SPY/ES (broad beta) or IWM/RTY (small-cap rotation).
Pair it with the Mongoose Compass v2 panel in a separate pane for the full dashboard.
Limitations & disclaimer
For information and education; not investment advice.
Data availability varies by plan (especially futures and DSPX). Fallbacks apply automatically.
Mongoose Compass Ribbon paints the price chart background by market regime and displays a suggested position size.
It mirrors the Compass panel’s 4-pillar score (0–4) and can lock calculations to Weekly while you view Daily or intraday charts.
Regimes
Expansion: score ≥ 3 (green)
Neutral: score = 2 (orange)
Contraction: score ≤ 1 (red)
Pillars (same as panel):
RS IWM/SPY (small-cap leadership)
Credit HYG/LQD (risk financing)
Growth Copper/Gold (cyclical vs safety)
Participation (first available): Breadth → CBOE:DSPX → RSP/SPY proxy
A floating label shows Score and Suggested size (default ramp: 0/30/60/90/100% for scores 0–4).
How to use
Anchor on Weekly. Keep Regime Timeframe = W so the ribbon shows the higher-timeframe state while you trade on Daily.
Act on flips:
Expansion (≥3): increase beta, reduce hedges.
Neutral (2): keep moderate beta; favor quality/mega vs small caps until RS or Cu/Au turns.
Contraction (≤1): de-risk, rotate defensive, add hedges.
Turn on the built-in alerts: Expansion Regime and Contraction Regime.
Methodology
Prices are fetched via request.security on the selected Regime Timeframe.
Each pillar uses ratio signals smoothed with an SMA (Smoothing Length), and binary rules:
RS / Credit / Growth: fast SMA(len) vs slow SMA(len*2)
Breadth: normalized > 60
DSPX: normalized < 40
RSP/SPY proxy: fast > slow
Score is the count of green pillars (0–4).
Suggested size is a fixed mapping from score (user-editable).
Settings
Sources
Defaults use liquid ETFs (BATS/AMEX). Copper/Gold can be switched to futures if your plan supports them.
Breadth (optional): paste a %>MA symbol if you have one. If blank, the script uses CBOE:DSPX; if DSPX isn’t available it falls back to RSP/SPY.
Calculation
Smoothing Length (20) – higher = steadier regime; lower = faster.
Normalization Length (60) – window for 0–100 scaling in pillar tests.
Regime Timeframe (W) – lock regime to Weekly while viewing lower timeframes.
Visual
Ribbon Opacity controls how strong the background shading is.
Recommended usage
Apply the Ribbon to SPY/ES (broad beta) or IWM/RTY (small-cap rotation).
Pair it with the Mongoose Compass v2 panel in a separate pane for the full dashboard.
Limitations & disclaimer
For information and education; not investment advice.
Data availability varies by plan (especially futures and DSPX). Fallbacks apply automatically.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
TheRealMongoose
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
TheRealMongoose
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。