OPEN-SOURCE SCRIPT
Entropic Structure Bands [JOAT]

Entropic Structure Bands [JOAT]
Introduction
Entropic Structure Bands is an open-source overlay indicator that dynamically selects the best-fitting Ordinary Least Squares regression window from recent structural pivots and surrounds that regression channel with entropy-adjusted deviation bands. The key innovation over standard regression channel indicators is twofold: the window length is selected optimally each bar by searching through available pivot anchors for the highest R² × log(N) quality score, and the band width is modulated by the current Shannon entropy of log returns — widening during chaotic periods and tightening during orderly ones.
Core Concepts
1. Optimal Regression Window Search
Rather than using a fixed lookback, the indicator records the bar index of every confirmed pivot high and low. Each bar, it tests several candidate windows anchored at recent pivots and selects the one that maximizes a performance score: R² multiplied by the natural log of the window length. This rewards both fit quality and window depth simultaneously:
Pine Script®
The regression channel therefore adapts to where significant price structure has occurred, not to an arbitrary fixed period.
2. Shannon Entropy Modulation
Shannon entropy of the log return distribution is computed using a histogram-binning approach. Low entropy means returns are concentrated — price is moving in an organized, directional way. High entropy means returns are evenly distributed — chaotic, noisy conditions. Band width scales with entropy:
Pine Script®
When entropy is low (below the configurable threshold), the market is classified as orderly and signals are enabled. This prevents signals from firing into chaotic conditions where regression bands have less predictive value.

3. Trend-Confluence Signal Logic
Signals require simultaneous alignment of six conditions: regression slope direction, price position relative to midline, recent pullback to the inner band, momentum confirmation, optional HTF slope alignment, optional ADX trending gate, and optional RSI gate. Each condition is individually toggleable. This multi-factor gate replaces simple band-crossover logic with a structured confluence requirement.
4. Forward Projection
The regression channel extends forward by a configurable number of bars beyond the right edge of the chart. A projection target label marks the estimated price at the end of the projection window based on the current slope and intercept. This gives visual context for where the regression model expects price to be if the current trend continues.
5. Z-Score Candle Coloring
Each candle's position within the channel is expressed as a Z-score (standard deviations from the regression midline). Candles far above the midline (overbought extension) are tinted bear-color; candles far below (oversold extension) are tinted bull-color. This provides immediate visual context for where price stands within its current regression structure.
Features
Input Parameters
Regression Engine:
Entropy System:
How to Use This Indicator
Step 1: Read the Slope Bias
Check the dashboard's Slope Bias row. BULLISH or BEARISH indicates the current regression direction. This is the primary directional input.
Step 2: Check Entropy State
LOW (orderly) entropy is the condition under which signals are most reliable. HIGH entropy warns that the regression model is operating in a chaotic environment.
Step 3: Wait for Signal Labels
LONG and SHORT labels appear only when the full confluence gate is satisfied. Each label shows entry price, TP1, TP2, stop loss, and R² quality.
Indicator Limitations
Originality Statement
The dynamic pivot-anchored regression window search using R² × log(N) scoring, combined with Shannon entropy-modulated band width and a six-condition confluence signal gate, is the original analytical architecture of this publication. No existing published Pine Script regression channel indicator implements adaptive window selection from pivot anchors with entropy modulation in this manner.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. Regression channels are mathematical models of past price behavior and do not predict future price. Trading involves substantial risk of loss.
-Made with passion by jackofalltrades
Introduction
Entropic Structure Bands is an open-source overlay indicator that dynamically selects the best-fitting Ordinary Least Squares regression window from recent structural pivots and surrounds that regression channel with entropy-adjusted deviation bands. The key innovation over standard regression channel indicators is twofold: the window length is selected optimally each bar by searching through available pivot anchors for the highest R² × log(N) quality score, and the band width is modulated by the current Shannon entropy of log returns — widening during chaotic periods and tightening during orderly ones.
Core Concepts
1. Optimal Regression Window Search
Rather than using a fixed lookback, the indicator records the bar index of every confirmed pivot high and low. Each bar, it tests several candidate windows anchored at recent pivots and selects the one that maximizes a performance score: R² multiplied by the natural log of the window length. This rewards both fit quality and window depth simultaneously:
The regression channel therefore adapts to where significant price structure has occurred, not to an arbitrary fixed period.
2. Shannon Entropy Modulation
Shannon entropy of the log return distribution is computed using a histogram-binning approach. Low entropy means returns are concentrated — price is moving in an organized, directional way. High entropy means returns are evenly distributed — chaotic, noisy conditions. Band width scales with entropy:
When entropy is low (below the configurable threshold), the market is classified as orderly and signals are enabled. This prevents signals from firing into chaotic conditions where regression bands have less predictive value.
3. Trend-Confluence Signal Logic
Signals require simultaneous alignment of six conditions: regression slope direction, price position relative to midline, recent pullback to the inner band, momentum confirmation, optional HTF slope alignment, optional ADX trending gate, and optional RSI gate. Each condition is individually toggleable. This multi-factor gate replaces simple band-crossover logic with a structured confluence requirement.
4. Forward Projection
The regression channel extends forward by a configurable number of bars beyond the right edge of the chart. A projection target label marks the estimated price at the end of the projection window based on the current slope and intercept. This gives visual context for where the regression model expects price to be if the current trend continues.
5. Z-Score Candle Coloring
Each candle's position within the channel is expressed as a Z-score (standard deviations from the regression midline). Candles far above the midline (overbought extension) are tinted bear-color; candles far below (oversold extension) are tinted bull-color. This provides immediate visual context for where price stands within its current regression structure.
Features
- Dynamic regression window: Optimal window selected each bar from pivot anchor scan
- R² quality gate: Configurable minimum R² prevents low-fit windows from being used
- Entropy-adjusted bands: Band width scales with Shannon entropy of log returns
- Multi-factor signal gate: Six independently configurable confluence conditions
- Forward projection: Channel extended beyond right edge with target label
- Z-score candle coloring: Candles painted by standard deviation position in channel
- Inner and outer bands (±1σ, ±2σ): Gradient-filled channel layers
- Glow-effect midline: Double-drawn center line with transparency for depth
- 10-row dashboard: R², entropy, Z-score, duration, HTF alignment, ADX, RSI, signal state
- JSON webhook alerts: Alert messages formatted as JSON with EP, TP, SL, and R²
Input Parameters
Regression Engine:
- Pivot Scan Horizon: Number of pivots to evaluate as regression anchors (default: 20)
- Pivot Sensitivity: Left/right bars for pivot confirmation (default: 5)
- Min R² Quality Gate: Minimum fit quality to use a window (default: 0.50)
- Band Multiplier 1/2: Inner and outer band standard deviation multiples (default: 1.0, 2.0)
Entropy System:
- Entropy Lookback: Bars for entropy calculation (default: 20)
- Entropy Bins: Histogram bins for return distribution (default: 10)
- Low Entropy Threshold: Threshold below which market is classified as orderly (default: 2.5)
How to Use This Indicator
Step 1: Read the Slope Bias
Check the dashboard's Slope Bias row. BULLISH or BEARISH indicates the current regression direction. This is the primary directional input.
Step 2: Check Entropy State
LOW (orderly) entropy is the condition under which signals are most reliable. HIGH entropy warns that the regression model is operating in a chaotic environment.
Step 3: Wait for Signal Labels
LONG and SHORT labels appear only when the full confluence gate is satisfied. Each label shows entry price, TP1, TP2, stop loss, and R² quality.
Indicator Limitations
- Regression channels repaint historically when the optimal window shifts to a new anchor; use the confirmed-bar signals for non-repainting entry logic
- In markets with very few pivots, the scan horizon may find suboptimal windows with low R²
- Shannon entropy requires sufficient lookback to produce stable estimates
Originality Statement
The dynamic pivot-anchored regression window search using R² × log(N) scoring, combined with Shannon entropy-modulated band width and a six-condition confluence signal gate, is the original analytical architecture of this publication. No existing published Pine Script regression channel indicator implements adaptive window selection from pivot anchors with entropy modulation in this manner.
Disclaimer
This indicator is provided for educational and informational purposes only. It is not financial advice. Regression channels are mathematical models of past price behavior and do not predict future price. Trading involves substantial risk of loss.
-Made with passion by jackofalltrades
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
The AI Trading Ecosystem, Built to win trades 📈
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Get Full Access 👇
jackofalltrades.vip 🌐
t.me/jackofalltradesvip 🃏
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.