OPEN-SOURCE SCRIPT
RichmondHillCM - Log-Price Regression Channel V1.2

RichmondHillCM - Log-Price Regression Channel V1.2
An OLS linear regression fitted to the logarithm of price, with standard-deviation bands (±1σ / ±2σ / ±3σ) projected around the fitted mean. Because the fit is done in log-space, the channel is geometric — it scales proportionally across very different price levels, which makes it well suited to long-trending instruments like SPY where a raw-price channel would distort.
⚠️ Designed for the WEEKLY (1W) timeframe. The default 252-bar lookback (~5 years of weekly data) and the band logic are tuned for weekly candles. A live banner at the top of the stats table turns red whenever the chart is not on a weekly timeframe.
Features
Log-space regression mean + ±1σ/±2σ/±3σ bands with optional fills
BUY / SELL labels on ±2σ crosses, optional STRONG BUY / SELL on ±3σ
Stats table: each band's price, % distance from current price, and Z-score
Background shading when price is stretched beyond ±2σ / ±3σ
Built-in alert conditions for every band cross and the mean
How to use
Best suited to long-term growth compounders like Google (GOOGL, SPY, NDX). Use it on the weekly (1W) timeframe and set your price axis to logarithmic scale for the bands to line up correctly.
Instrument: growth compounders / steady long-term trenders (e.g. GOOGL, MSFT, SPY)
Timeframe: weekly (1W)
Price axis: log scale (right-click the axis → "Logarithmic")
How to read it: price drifting toward ±2σ/±3σ is unusually far from its own trend; the bands act like a statistical rubber band. Use band touches as context, not standalone entries.
For research and educational purposes only. Not financial advice.
An OLS linear regression fitted to the logarithm of price, with standard-deviation bands (±1σ / ±2σ / ±3σ) projected around the fitted mean. Because the fit is done in log-space, the channel is geometric — it scales proportionally across very different price levels, which makes it well suited to long-trending instruments like SPY where a raw-price channel would distort.
⚠️ Designed for the WEEKLY (1W) timeframe. The default 252-bar lookback (~5 years of weekly data) and the band logic are tuned for weekly candles. A live banner at the top of the stats table turns red whenever the chart is not on a weekly timeframe.
Features
Log-space regression mean + ±1σ/±2σ/±3σ bands with optional fills
BUY / SELL labels on ±2σ crosses, optional STRONG BUY / SELL on ±3σ
Stats table: each band's price, % distance from current price, and Z-score
Background shading when price is stretched beyond ±2σ / ±3σ
Built-in alert conditions for every band cross and the mean
How to use
Best suited to long-term growth compounders like Google (GOOGL, SPY, NDX). Use it on the weekly (1W) timeframe and set your price axis to logarithmic scale for the bands to line up correctly.
Instrument: growth compounders / steady long-term trenders (e.g. GOOGL, MSFT, SPY)
Timeframe: weekly (1W)
Price axis: log scale (right-click the axis → "Logarithmic")
How to read it: price drifting toward ±2σ/±3σ is unusually far from its own trend; the bands act like a statistical rubber band. Use band touches as context, not standalone entries.
For research and educational purposes only. Not financial advice.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.