OPEN-SOURCE SCRIPT
AlphaQuant Statistical Intelligence

█ ALPHAQUANT STATISTICAL INTELLIGENCE (QSI) [FREE]
Quantitative Market Quality Analysis
A quantitative market analysis tool that measures the statistical "quality" of market conditions using three core modules: Hurst Regime Engine, Shannon Entropy Flow, and Price Efficiency Ratio. These combine into a single QSI Composite Score (0-100) that rates whether current conditions are favorable for trading or not.
Free and Open Source.
█ THE CONCEPT: WHY STATISTICAL MARKET QUALITY MATTERS
Most indicators answer "which direction?" — QSI answers a different question: "Should I be trading right now?"
Markets alternate between regimes: trending, mean-reverting, chaotic, and efficient. QSI identifies these regimes in real-time so you can adapt your strategy accordingly. A trending Hurst regime favors breakout strategies. A mean-reverting regime favors fading. High entropy means the market is chaotic — reduce size. High efficiency means clean directional moves — increase conviction.
█ CORE MODULES
1. Hurst Regime Engine
Calculates the Hurst Exponent via Rescaled Range (R/S) analysis — a robust statistical method from hydrology adapted for financial markets.
2. Shannon Entropy Flow
Measures the information entropy of the return distribution using the Shannon Entropy formula from information theory.
3. Price Efficiency Ratio
Measures directional efficiency by comparing net price movement to gross price movement over N bars.
█ QSI COMPOSITE SCORE
The three modules combine into a single 0-100 score with fixed weights:
Score interpretation:
█ DASHBOARD
A compact, dark-themed info panel displaying:
█ ALERTS (8 CONDITIONS)
█ PRO VERSION
The PRO version adds:
█ NON-REPAINTING
All calculations use confirmed bar data only. The Hurst Exponent is calculated from historical log-returns. Shannon Entropy uses a rolling window of past data. Price Efficiency uses closed bars only. No future data leakage. No repainting.
█ WORKS ON
Crypto, Forex, Stocks, Futures, Indices — any timeframe from 1 minute to Monthly.
█ DISCLAIMER
This indicator is for educational and informational purposes only. It does not constitute financial advice. Always do your own research and manage your risk. Past performance does not guarantee future results. Trading involves substantial risk of loss.
Quantitative Market Quality Analysis
A quantitative market analysis tool that measures the statistical "quality" of market conditions using three core modules: Hurst Regime Engine, Shannon Entropy Flow, and Price Efficiency Ratio. These combine into a single QSI Composite Score (0-100) that rates whether current conditions are favorable for trading or not.
Free and Open Source.
█ THE CONCEPT: WHY STATISTICAL MARKET QUALITY MATTERS
Most indicators answer "which direction?" — QSI answers a different question: "Should I be trading right now?"
Markets alternate between regimes: trending, mean-reverting, chaotic, and efficient. QSI identifies these regimes in real-time so you can adapt your strategy accordingly. A trending Hurst regime favors breakout strategies. A mean-reverting regime favors fading. High entropy means the market is chaotic — reduce size. High efficiency means clean directional moves — increase conviction.
█ CORE MODULES
1. Hurst Regime Engine
Calculates the Hurst Exponent via Rescaled Range (R/S) analysis — a robust statistical method from hydrology adapted for financial markets.
- H > 0.55 — Trending regime. Price has "memory" — breakout/trend-following strategies work well.
- H = 0.50 — Random Walk. No statistical edge — the market is coin-flipping. Reduce size.
- H < 0.45 — Mean-Reverting regime. Price has "anti-memory" — fade strategies work well.
2. Shannon Entropy Flow
Measures the information entropy of the return distribution using the Shannon Entropy formula from information theory.
- High Entropy (>70) — Returns spread across many bins = chaotic, unpredictable. Reduce exposure.
- Low Entropy (<30) — Returns cluster in few bins = ordered, predictable. Good for systematic strategies.
3. Price Efficiency Ratio
Measures directional efficiency by comparing net price movement to gross price movement over N bars.
- High Efficiency (>30%) — Price moving cleanly in one direction. Trend-following conditions.
- Low Efficiency (<10%) — Price chopping with no net progress. Avoid or use range strategies.
█ QSI COMPOSITE SCORE
The three modules combine into a single 0-100 score with fixed weights:
- Hurst Edge: 40% — How strong is the regime signal?
- Inverse Entropy: 35% — How ordered is the market?
- Efficiency: 25% — How clean are the price moves?
Score interpretation:
- > 70 — PRIME — Optimal conditions, full conviction
- 55-70 — FAVORABLE — Good conditions, normal sizing
- 40-55 — NEUTRAL — Mixed signals, proceed with caution
- 25-40 — CAUTION — Poor conditions, reduce size
- < 25 — AVOID — Worst conditions, stay out
█ DASHBOARD
A compact, dark-themed info panel displaying:
- QSI INDEX — Current composite value with regime label
- HURST — Current Hurst exponent with regime classification
- ENTROPY — Current entropy score with regime classification
- EFFICIENCY — Current efficiency ratio with regime classification
- WEIGHTS — Module weight distribution (H:40 E:35 F:25)
█ ALERTS (8 CONDITIONS)
- QSI: PRIME Conditions — Composite entered prime zone (>70)
- QSI: AVOID Conditions — Composite dropped to avoid zone (<25)
- QSI: Conditions Improving — Composite crossed above 55
- QSI: Conditions Deteriorating — Composite dropped below 40
- QSI: Hurst → Trending — Hurst crossed above 0.55
- QSI: Hurst → Mean-Reversion — Hurst crossed below 0.45
- QSI: Entropy → Chaos — Entropy spiked above 70
- QSI: Entropy → Order — Entropy dropped below 30
█ PRO VERSION
The PRO version adds:
- Markov Transition Probabilities — Statistical prediction of next-bar direction
- Correlation Intelligence — Auto-benchmark correlation with breakdown detection
- Fractal Dimension — Higuchi fractal complexity analysis
- Absorption Detection — High volume + low range = institutional activity
- Trading Style Presets — Auto/Scalping/Daytrading/Swing/Position
- Asset Auto-Optimization — Automatic parameter tuning per asset class
- Profile-Adaptive Weighting — Dynamic composite weights based on style + asset
█ NON-REPAINTING
All calculations use confirmed bar data only. The Hurst Exponent is calculated from historical log-returns. Shannon Entropy uses a rolling window of past data. Price Efficiency uses closed bars only. No future data leakage. No repainting.
█ WORKS ON
Crypto, Forex, Stocks, Futures, Indices — any timeframe from 1 minute to Monthly.
█ DISCLAIMER
This indicator is for educational and informational purposes only. It does not constitute financial advice. Always do your own research and manage your risk. Past performance does not guarantee future results. Trading involves substantial risk of loss.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.