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 de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.