OPEN-SOURCE SCRIPT
Entropy Balance Oscillator [JOAT]

Entropy Balance Oscillator - Chaos Theory Edition
Overview
Entropy Balance Oscillator is an open-source oscillator indicator that applies chaos theory concepts to market analysis. It calculates market entropy (disorder/randomness), balance (price position within range), and various chaos metrics to identify whether the market is in an ordered, chaotic, or balanced state. This helps traders understand market regime and adjust their strategies accordingly.
What This Indicator Does
The indicator calculates and displays:
- Entropy - Measures market disorder using return distribution analysis
- Balance - Price position within the high-low range, normalized to -1 to +1
- Lyapunov Exponent - Estimates sensitivity to initial conditions (chaos indicator)
- Hurst Exponent - Measures long-term memory in price series (trend persistence)
- Strange Attractor - Simulated attractor points for visualization
- Bifurcation Detection - Identifies potential regime change points
- Chaos Index - Combined entropy and volatility score
- Market Phase - Classification as CHAOS, ORDER, or BALANCED
How It Works
Entropy is calculated using return distribution:
calculateEntropy(series float price, simple int period) =>
// Calculate returns and their absolute values
// Sum absolute returns for normalization
// Apply Shannon entropy formula: -sum(p * log(p))
float entropy = 0.0
for i = 0 to array.size(returns) - 1
float prob = math.abs(array.get(returns, i)) / sumAbs
if prob > 0
entropy -= prob * math.log(prob)
entropy
Balance measures price position within range:
calculateBalance(series float high, series float low, series float close, simple int period) =>
float range = high - low
float position = (close - low) / (range > 0 ? range : 1)
float balance = ta.ema(position, period)
(balance - 0.5) * 2 // Normalize to -1 to +1
Lyapunov Exponent estimates chaos sensitivity:
lyapunovExponent(series float price, simple int period) =>
float sumLog = 0.0
for i = 1 to period
float ratio = price[i - 1] > 0 ? math.abs(price / price[i - 1]) : 1.0
if ratio > 0
sumLog += math.log(ratio)
lyapunov := sumLog / period
Hurst Exponent measures trend persistence:
- H > 0.5: Trending/persistent behavior
- H = 0.5: Random walk
- H < 0.5: Mean-reverting behavior
Signal Generation
Phase changes and extreme conditions generate signals:
- Chaos Phase: Normalized entropy exceeds chaos threshold (default 0.7)
- Order Phase: Normalized entropy falls below order threshold (default 0.3)
- Extreme Chaos: Entropy exceeds 1.5x chaos threshold
- Extreme Order: Entropy falls below 0.5x order threshold
- Bifurcation: Variance exceeds 2x average variance
Dashboard Panel (Top-Right)
- Market Phase - Current phase (CHAOS/ORDER/BALANCED)
- Entropy Level - Normalized entropy value
- Balance - Current balance reading (-1 to +1)
- Chaos Index - Combined chaos score percentage
- Volatility - Current price volatility
- Lyapunov Exp - Lyapunov exponent value
- Hurst Exponent - Hurst exponent value
- Chaos Score - Overall chaos assessment
- Status - Current market status
Visual Elements
- Entropy Line - Main oscillator showing normalized entropy
- Entropy EMA - Smoothed entropy for trend reference
- Balance Area - Filled area showing balance direction
- Chaos/Order Thresholds - Horizontal dashed lines
- Lyapunov Line - Step line showing Lyapunov exponent
- Strange Attractor - Circle plots showing attractor points
- Phase Space - Line showing phase space reconstruction
- Phase Background - Background color based on current phase
- Extreme Markers - X-cross for extreme chaos, diamond for extreme order
- Bifurcation Markers - Circles at potential regime changes
Input Parameters
- Entropy Period (default: 20) - Period for entropy calculation
- Balance Period (default: 14) - Period for balance calculation
- Chaos Threshold (default: 0.7) - Threshold for chaos phase
- Order Threshold (default: 0.3) - Threshold for order phase
- Lyapunov Exponent (default: true) - Enable Lyapunov calculation
- Hurst Exponent (default: true) - Enable Hurst calculation
- Strange Attractor (default: true) - Enable attractor visualization
- Bifurcation Detection (default: true) - Enable bifurcation detection
Suggested Use Cases
- Identify market regime for strategy selection (trend-following vs mean-reversion)
- Watch for phase changes as potential trading environment shifts
- Use Hurst exponent to assess trend persistence
- Monitor chaos index for volatility regime awareness
- Avoid trading during extreme chaos phases
Timeframe Recommendations
Best on 1H to Daily charts. Chaos metrics require sufficient data for meaningful calculations.
Limitations
- Chaos theory concepts are applied as analogies, not rigorous mathematical implementations
- Lyapunov and Hurst calculations are simplified approximations
- Strange attractor visualization is conceptual
- Bifurcation detection uses variance as proxy
Open-Source and Disclaimer
This script is published as open-source under the Mozilla Public License 2.0 for educational purposes. It does not constitute financial advice. Past performance does not guarantee future results. Always use proper risk management.
- Made with passion by officialjackofalltrades
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
#1 Full Stack AI Trading Community — jackofalltrades.vip | 2026: The Era of AI Trading Mastery📈 AI Automation • AI Trading Bots • Indicators • Strategies • Limitless Potential • Institutional Grade Products • t.me/jackofalltradesvip
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
#1 Full Stack AI Trading Community — jackofalltrades.vip | 2026: The Era of AI Trading Mastery📈 AI Automation • AI Trading Bots • Indicators • Strategies • Limitless Potential • Institutional Grade Products • t.me/jackofalltradesvip
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.