OPEN-SOURCE SCRIPT
Log Regression Channel (1000 Bars)

This indicator fits a linear regression to the natural log of price over a configurable lookback (default 1000 bars), then plots the resulting trend line along with standard deviation bands above and below it.
Working in log space rather than raw price means the fit follows percentage-based (exponential) growth, which suits assets that compound over time. The center line represents the statistical trend over the lookback window. The inner bands sit at 1 standard deviation of the regression residuals, and the outer bands at 2 standard deviations, giving a sense of how stretched price is relative to its own trend: near the upper bands is historically extended, near the lower bands is historically compressed.
How it works:
- Computes a least-squares linear regression on log(price) across the lookback window
- Measures the standard deviation of the residuals (how far price typically strays from the fit)
- Draws the center line plus inner (1 SD) and outer (2 SD) bands, extended to the right
- Auto-adapts to each symbol and timeframe; bars with missing or non-positive prices are skipped so it renders across a wide range of assets
Inputs:
- Lookback length (number of bars used in the fit)
- Source
- Inner and outer band multipliers (default 1 and 2 standard deviations)
- Editable colors and line widths for the center line and each band set
How to use:
View on a log-scaled chart for correct interpretation (the channel is fit in log space). Higher timeframes describe a longer-term trend; lower timeframes describe a shorter one. Most meaningful on assets with a persistent growth trend, and less informative on flat, range-bound, or structurally declining markets. Best used as one input among several rather than a standalone signal.
Working in log space rather than raw price means the fit follows percentage-based (exponential) growth, which suits assets that compound over time. The center line represents the statistical trend over the lookback window. The inner bands sit at 1 standard deviation of the regression residuals, and the outer bands at 2 standard deviations, giving a sense of how stretched price is relative to its own trend: near the upper bands is historically extended, near the lower bands is historically compressed.
How it works:
- Computes a least-squares linear regression on log(price) across the lookback window
- Measures the standard deviation of the residuals (how far price typically strays from the fit)
- Draws the center line plus inner (1 SD) and outer (2 SD) bands, extended to the right
- Auto-adapts to each symbol and timeframe; bars with missing or non-positive prices are skipped so it renders across a wide range of assets
Inputs:
- Lookback length (number of bars used in the fit)
- Source
- Inner and outer band multipliers (default 1 and 2 standard deviations)
- Editable colors and line widths for the center line and each band set
How to use:
View on a log-scaled chart for correct interpretation (the channel is fit in log space). Higher timeframes describe a longer-term trend; lower timeframes describe a shorter one. Most meaningful on assets with a persistent growth trend, and less informative on flat, range-bound, or structurally declining markets. Best used as one input among several rather than a standalone signal.
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.