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.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน