OPEN-SOURCE SCRIPT
Wx Linear / Log Regression Channel

Wx LinReg+ — Linear Regression Channel (with optional log scale)
LinReg+ is a modified version of TradingView’s built-in Linear Regression indicator.
In normal mode it behaves the same as the original script (same math, same channel) — but it adds a few extra tools for longer-term trend work and cleaner risk management.
⸻
What it does
• Plots a linear regression line over the last N bars (default 150) to show the dominant trend.
• Draws upper and lower channel lines at a chosen number of standard deviations from the regression line.
• Highlights when price moves unusually far away from its baseline, which can signal potential exhaustion or mean reversion.
• Optionally fits the channel on log(price) so the trend is percentage-based, which is much more realistic for long-term stocks, growth names, and crypto.
⸻
What’s different vs. the original Linear Regression
Everything from the standard TradingView Linear Regression is preserved, plus:
1. Use log price (percent-based)
• When checked, the regression is computed on log(source) instead of raw price.
• This makes the channel scale naturally with percentage moves (e.g., a move from 50 → 100 is treated like 100 → 200).
• Very useful on higher timeframes or multi-year trends.
2. Pearson’s R (trend quality)
• Optional label that shows Pearson’s correlation coefficient between price and the regression line.
• Values near +1 / −1 = strong, clean trend.
Values near 0 = choppy, noisy market.
3. Extend lines left / right
• Lets you project the channel back in time, forward in time, or both, without redrawing.
4. Default length
• Default Length = 150 bars to match a common swing / position-trading look-back out of the box.
⸻
Inputs
Channel Settings
• Length
Number of bars used for the regression calculation (default 150).
• Source
Price source used for the channel (close by default).
• Use log price (percent-based)
When enabled, regression is performed on log(price); visually still plotted on the normal scale.
• Upper Deviation / Lower Deviation
Number of standard deviations above/below the regression line to draw the upper and lower channel.
• Use Upper Deviation / Use Lower Deviation
Toggle visibility/use of each side of the channel.
Display Settings
• Show Pearson’s R
Shows a label with the correlation coefficient so you can quickly judge trend strength.
• Extend Lines Left / Extend Lines Right
Controls how far the channel lines are extended on the chart.
Color Settings
• Separate colors for upper band, lower band, and the filled areas between them.
⸻
How traders often use it
• Spot when price is stretched relative to its regression channel (possible fade / reversion zones).
• Confirm a trend regime: strong Pearson’s R + price riding the upper band = robust uptrend.
• On log mode, see whether a name is accelerating or decelerating in percentage terms over multi-month / multi-year windows.
This is a visual tool only – it doesn’t place orders or manage risk for you.
LinReg+ is a modified version of TradingView’s built-in Linear Regression indicator.
In normal mode it behaves the same as the original script (same math, same channel) — but it adds a few extra tools for longer-term trend work and cleaner risk management.
⸻
What it does
• Plots a linear regression line over the last N bars (default 150) to show the dominant trend.
• Draws upper and lower channel lines at a chosen number of standard deviations from the regression line.
• Highlights when price moves unusually far away from its baseline, which can signal potential exhaustion or mean reversion.
• Optionally fits the channel on log(price) so the trend is percentage-based, which is much more realistic for long-term stocks, growth names, and crypto.
⸻
What’s different vs. the original Linear Regression
Everything from the standard TradingView Linear Regression is preserved, plus:
1. Use log price (percent-based)
• When checked, the regression is computed on log(source) instead of raw price.
• This makes the channel scale naturally with percentage moves (e.g., a move from 50 → 100 is treated like 100 → 200).
• Very useful on higher timeframes or multi-year trends.
2. Pearson’s R (trend quality)
• Optional label that shows Pearson’s correlation coefficient between price and the regression line.
• Values near +1 / −1 = strong, clean trend.
Values near 0 = choppy, noisy market.
3. Extend lines left / right
• Lets you project the channel back in time, forward in time, or both, without redrawing.
4. Default length
• Default Length = 150 bars to match a common swing / position-trading look-back out of the box.
⸻
Inputs
Channel Settings
• Length
Number of bars used for the regression calculation (default 150).
• Source
Price source used for the channel (close by default).
• Use log price (percent-based)
When enabled, regression is performed on log(price); visually still plotted on the normal scale.
• Upper Deviation / Lower Deviation
Number of standard deviations above/below the regression line to draw the upper and lower channel.
• Use Upper Deviation / Use Lower Deviation
Toggle visibility/use of each side of the channel.
Display Settings
• Show Pearson’s R
Shows a label with the correlation coefficient so you can quickly judge trend strength.
• Extend Lines Left / Extend Lines Right
Controls how far the channel lines are extended on the chart.
Color Settings
• Separate colors for upper band, lower band, and the filled areas between them.
⸻
How traders often use it
• Spot when price is stretched relative to its regression channel (possible fade / reversion zones).
• Confirm a trend regime: strong Pearson’s R + price riding the upper band = robust uptrend.
• On log mode, see whether a name is accelerating or decelerating in percentage terms over multi-month / multi-year windows.
This is a visual tool only – it doesn’t place orders or manage risk for you.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.