OPEN-SOURCE SCRIPT
Quant Signals: Entropy w/ Forecast

This is the first of many quantitative signals I plan to create for TV users.
Most technical analysis (TA) tools—like moving averages, oscillators, or chart patterns—are heuristic: they’re based on visually identifiable shapes, threshold crossovers, or empirically chosen rules. These methods rarely quantify the information content or structural complexity of market data. By quantifying market predictability before making a forecast, this method filters out noise and focuses your trading only during statistically favorable conditions—something traditional TA cannot objectively measure.
This MEPP-based approach is quantitative and model-free:
It comes from information theory and measures Shannon entropy rate to assess how predictable the market is at any moment.
Instead of interpreting price formations, it uses a data-compression algorithm (Lempel–Ziv) to capture hidden structure in the sequence of returns.
Forecasts are generated using a principle from statistical physics (Maximum Entropy Production), not historical chart patterns.
In short, this method measures the market's predictability BEFORE deciding a directional forecast is worth trusting. This tool is to inform TA traders on the market's current regime, whether it is smooth and predictable or it is volatile and turbulent.
Technical Introduction:
In information theory, Shannon entropy measures the uncertainty (or information content) in a sequence of data. For markets, the entropy rate captures how much new information price returns generate over time:
By discretizing recent returns into quartile-based states, this indicator:
Measurements & How to Use Them
TLDR: HIGH ENTROPY -> information generation/market shift -> Don't trust forecast/strategy
1. H (bits/sym)
2. H_max (log₂Ω)
3. Entropy (norm)
4. Regime
5. Next State (MEPP Forecast)
Discrete return state (1–4) predicted to occur next, chosen to maximize entropy production:
6. Bias
Simplified label from the Next State:
States 1–2 = Bearish bias (red)
States 3–4 = Bullish bias (green)
Align strategy direction with bias only in LOW regime.
Most technical analysis (TA) tools—like moving averages, oscillators, or chart patterns—are heuristic: they’re based on visually identifiable shapes, threshold crossovers, or empirically chosen rules. These methods rarely quantify the information content or structural complexity of market data. By quantifying market predictability before making a forecast, this method filters out noise and focuses your trading only during statistically favorable conditions—something traditional TA cannot objectively measure.
This MEPP-based approach is quantitative and model-free:
It comes from information theory and measures Shannon entropy rate to assess how predictable the market is at any moment.
Instead of interpreting price formations, it uses a data-compression algorithm (Lempel–Ziv) to capture hidden structure in the sequence of returns.
Forecasts are generated using a principle from statistical physics (Maximum Entropy Production), not historical chart patterns.
In short, this method measures the market's predictability BEFORE deciding a directional forecast is worth trusting. This tool is to inform TA traders on the market's current regime, whether it is smooth and predictable or it is volatile and turbulent.
Technical Introduction:
In information theory, Shannon entropy measures the uncertainty (or information content) in a sequence of data. For markets, the entropy rate captures how much new information price returns generate over time:
- Low entropy rate → price changes are more structured and predictable.
- High entropy rate → price changes are more random and unpredictable.
By discretizing recent returns into quartile-based states, this indicator:
- Calculates the normalized entropy rate as a regime filter.
- Uses MEPP to forecast the next state that maximizes entropy production.
- Displays both the regime status (predictable vs chaotic) and the forecast bias (bullish/bearish) in a dashboard.
Measurements & How to Use Them
TLDR: HIGH ENTROPY -> information generation/market shift -> Don't trust forecast/strategy
1. H (bits/sym)
- Shannon entropy rate of the last μ discrete returns, in bits per symbol (0–2).
- Lower → more predictable; higher → more random.
- Use as a raw measure of market structure.
2. H_max (log₂Ω)
- Theoretical maximum entropy for Ω states. Here Ω = 4 → H_max = 2.0 bits.
- Reference value for normalization.
3. Entropy (norm)
- H / H_max, scaled between 0 and 1.
- < 0.5–0.6 → predictable regime; > 0.6 → chaotic regime.
- Main regime filter — forecasts are more reliable when below your threshold.
4. Regime
- Label based on Entropy (norm) vs your entThresh.
- LOW (predictable) = higher odds forecast will be correct.
- HIGH (chaotic) = forecasts less reliable.
5. Next State (MEPP Forecast)
Discrete return state (1–4) predicted to occur next, chosen to maximize entropy production:
- Large Down (strong bearish)
- Small Down (mild bearish)
- Small Up (mild bullish)
- Large Up (strong bullish)
- Use as your bias direction.
6. Bias
Simplified label from the Next State:
States 1–2 = Bearish bias (red)
States 3–4 = Bullish bias (green)
Align strategy direction with bias only in LOW regime.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。