OPEN-SOURCE SCRIPT
Aggiornato SPDR Sector ETFs Strength Matrix PRO | Auto·Scalp·Swing·Manual

Strategy type
Sector-rotation breadth engine (long/short) built for index futures, sector ETFs, or any chart symbol that reacts to US-equity flows.
What it does
Continuously scores all 11 SPDR sector ETFs and triggers trades whenever your chosen driver sector shifts from broad under-performance to dominance (or vice-versa). Think of it as trading the “heartbeat” of a single sector rather than the chart in front of you.
Four strength factors (−100 → +100 each)
• Chaikin Money-Flow (CMF) – 20-bar accumulation/distribution pressure
• Relative Volume (RVOL) – current volume ÷ 40-bar SMA
• Relative Volatility (VOL) – ATR % ÷ 10-bar SMA of ATR %
• Normalised Momentum (MOM) – price momentum ÷ ATR %
Matrix build
For every bar, each factor finds the strongest and weakest of the 11 sectors.
Factor weights (default 35 / 35 / 20 / 10 %) convert those winners/losers into ± scores.
Sum × 100 → TOTAL % per sector (range −100…+100).
Strength trigger
• Entry long when driver-sector TOTAL ≥ Enter-thr (default = +60 %).
• Entry short when TOTAL ≤ −Enter-thr and RVOL < 1 (avoid shorting into high-volume squeezes).
• Exit when TOTAL crosses Exit-thr (default = −50 % for longs, +50 % for shorts).
Risk engine
• Initial stop = ATR × 4 • Optional trailing stop = ATR × 4
• Long-only toggle for higher-time-frame trend followers.
• No pyramiding beyond 1 position.
Visual aids
• 6-column Sector Matrix table (CMF / RVOL / VOL / MOM / TOTAL).
• Driver sector row is orange-highlighted; strongest/weakest cells glow green/red.
All request.security() calls use lookahead_off → zero repaint.
Default inputs (H-chart template)
Reference TF = Chart
CMF length = 20 RVOL window = 40
ATR length = 14 VOL window = 10
Momentum length = 10
Factor weights = 35 / 35 / 20 / 10
Enter when |TOTAL| ≥ 60 %
Exit threshold −50 %
Stop ATR× / Trail ATR× = 4 / 4
Back-test properties (screenshots)
Initial capital 10 000
Order size 5 % of equity
Pyramiding 1
Commission 0.03 %
Slippage 5 ticks
Fills Bar magnifier ✔ · On bar close ✔ · Standard OHLC ✔
How to use
Add the script to any symbol (e.g., SPY, QQQ, MSFT, NVDA, XLK...).
Select the sector you believe leads that symbol (XLK by default).
Tune Enter/Exit thresholds to your volatility appetite (30–100 %).
Adjust ATR stops/trails to match instrument volatility.
Forward-test; align commission & slippage with your broker.
Important notes
• Works on every timeframe; factors scale automatically.
• Code is open-source, uses only TradingView’s internal data.
• No look-ahead, no intrabar repaint.
• Short entries conditioned on quiet volume to reduce squeeze risk.
• Historical performance ≠ future results — manage risk accordingly.
Credits
Inspired by currency strength initial idea;
table UI and factor framework handcrafted for TradingView.
Trade smart, ride the strongest sector flows, and let breadth be your edge!
Sector-rotation breadth engine (long/short) built for index futures, sector ETFs, or any chart symbol that reacts to US-equity flows.
What it does
Continuously scores all 11 SPDR sector ETFs and triggers trades whenever your chosen driver sector shifts from broad under-performance to dominance (or vice-versa). Think of it as trading the “heartbeat” of a single sector rather than the chart in front of you.
Four strength factors (−100 → +100 each)
• Chaikin Money-Flow (CMF) – 20-bar accumulation/distribution pressure
• Relative Volume (RVOL) – current volume ÷ 40-bar SMA
• Relative Volatility (VOL) – ATR % ÷ 10-bar SMA of ATR %
• Normalised Momentum (MOM) – price momentum ÷ ATR %
Matrix build
For every bar, each factor finds the strongest and weakest of the 11 sectors.
Factor weights (default 35 / 35 / 20 / 10 %) convert those winners/losers into ± scores.
Sum × 100 → TOTAL % per sector (range −100…+100).
Strength trigger
• Entry long when driver-sector TOTAL ≥ Enter-thr (default = +60 %).
• Entry short when TOTAL ≤ −Enter-thr and RVOL < 1 (avoid shorting into high-volume squeezes).
• Exit when TOTAL crosses Exit-thr (default = −50 % for longs, +50 % for shorts).
Risk engine
• Initial stop = ATR × 4 • Optional trailing stop = ATR × 4
• Long-only toggle for higher-time-frame trend followers.
• No pyramiding beyond 1 position.
Visual aids
• 6-column Sector Matrix table (CMF / RVOL / VOL / MOM / TOTAL).
• Driver sector row is orange-highlighted; strongest/weakest cells glow green/red.
All request.security() calls use lookahead_off → zero repaint.
Default inputs (H-chart template)
Reference TF = Chart
CMF length = 20 RVOL window = 40
ATR length = 14 VOL window = 10
Momentum length = 10
Factor weights = 35 / 35 / 20 / 10
Enter when |TOTAL| ≥ 60 %
Exit threshold −50 %
Stop ATR× / Trail ATR× = 4 / 4
Back-test properties (screenshots)
Initial capital 10 000
Order size 5 % of equity
Pyramiding 1
Commission 0.03 %
Slippage 5 ticks
Fills Bar magnifier ✔ · On bar close ✔ · Standard OHLC ✔
How to use
Add the script to any symbol (e.g., SPY, QQQ, MSFT, NVDA, XLK...).
Select the sector you believe leads that symbol (XLK by default).
Tune Enter/Exit thresholds to your volatility appetite (30–100 %).
Adjust ATR stops/trails to match instrument volatility.
Forward-test; align commission & slippage with your broker.
Important notes
• Works on every timeframe; factors scale automatically.
• Code is open-source, uses only TradingView’s internal data.
• No look-ahead, no intrabar repaint.
• Short entries conditioned on quiet volume to reduce squeeze risk.
• Historical performance ≠ future results — manage risk accordingly.
Credits
Inspired by currency strength initial idea;
table UI and factor framework handcrafted for TradingView.
Trade smart, ride the strongest sector flows, and let breadth be your edge!
Note di rilascio
added commentScript open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
🔻Website: hercules.money/
🔻Blog: hercules.money/blog/
🔻Telegram : t.me/hercules_trading
🔻Trader Psychology Profile – thelumenism.com/
🔻Blog: hercules.money/blog/
🔻Telegram : t.me/hercules_trading
🔻Trader Psychology Profile – thelumenism.com/
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.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
🔻Website: hercules.money/
🔻Blog: hercules.money/blog/
🔻Telegram : t.me/hercules_trading
🔻Trader Psychology Profile – thelumenism.com/
🔻Blog: hercules.money/blog/
🔻Telegram : t.me/hercules_trading
🔻Trader Psychology Profile – thelumenism.com/
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.