OPEN-SOURCE SCRIPT
Std Dev Channel [fmb]

What it is
A professional regression channel that combines standard deviation divisions, an extreme price envelope, and a trend quality gauge. It is designed for fast read-and-act decisions on any timeframe, with sensible presets and log-space math for instruments that trend exponentially.
Why it’s different
Most channels draw fixed ±1σ and ±2σ around a regression line. This tool adds:
- Fibonacci-spaced σ divisions for precise scaling
- An objective MaxEnvelope of actual extremes with optional 1.272 and 1.618 extensions
- Pearson’s R labelling that classifies the trend as Strong Up, Moderate, Weak, or Strong Down
- A log-space option so channels behave correctly on long trends and high beta charts
How it works
Base line
- Linear regression of the last Length bars, drawn as a ray.
- Optional colour change by regime using Pearson’s R.
Divisions (StdDev or MaxEnvelope)
- StdDev basis: σ of residuals around the regression line.
- MaxEnvelope basis: distances from the base line to the farthest highs and lows in the lookback.
- Divisions can be Fibonacci multiples (0.382, 0.618, 1.000, 1.272 by default) or uniform steps.
Outer rails
- ENV 1.0 touches the farthest highs and lows within the window.
- Optional extensions at 1.272 and 1.618 highlight stretch and breakout zones.
Trend quality (Pearson’s R)
- R is computed on the same series and window.
- Default thresholds: Strong when |R| ≥ 0.70, Weak when |R| < 0.40.
- The label reads: R 0.XXX • Class, plotted near the most recent base value.
Log-space math
- When enabled, the model runs on ln(price) and converts the outputs back to price.
- Safer on multi-year charts and large percentage trends.
Presets
- Swing: Length 125, StdDev basis, Fib divisions, ENV 1.0 and 1.272 on
- Intraday: Length 240, StdDev basis, simple ±1 and ±2 style divisions, ENV off by default
- Position: Length 200, StdDev basis, compact Fib set for higher timeframes
You can turn preset overrides off to make every input respond instantly.
Inputs you will actually use
- Length, Source, Log-space ON or OFF
- Basis: StdDev or MaxEnvelope
- Divisions: Fib list or Step and Max multiple
- Outer rails: show ENV 1.0, show 1.272, show 1.618
- Labels and sizes, extend left or right
- Hide divisions or outer rails automatically when the regime is Weak
Alerts included
- Close crosses above or below ENV 1.0
- Close crosses above or below ENV 1.272 and 1.618 (if enabled)
Practical playbook
Trend following
- In Strong Uptrend: buy pullbacks near 0.382 to 0.618 above the base with stops just beyond the next lower division.
- In Strong Downtrend: sell bounces into 0.382 to 0.618 below the base with stops just beyond the next upper division.
Mean reversion
- When R is Moderate or Weak, fade moves that tag ENV 1.0 back toward the base.
- If price closes through an ENV extension, treat it as potential regime change and stand down on fades.
Breakouts
- A close through ENV 1.0 with R rising toward Strong often precedes trend acceleration.
- Use the next division or the 1.272 rail as the first target and trail on the base.
Tips
- Keep Length stable across symbols you compare. Consistency beats curve fitting.
- Use log-space on multi-year equities and crypto. Use linear for short intraday work.
- If you want a classic look, disable Fib and rails, set Step 1.0 and Max 2.0.
Notes
- The tool draws more lines when Fib divisions are active. If it feels busy, show divisions only and hide labels, or keep ENV 1.0 plus one extension.
- Pearson’s R is descriptive, not predictive. Combine with price structure and volume for entries.
A professional regression channel that combines standard deviation divisions, an extreme price envelope, and a trend quality gauge. It is designed for fast read-and-act decisions on any timeframe, with sensible presets and log-space math for instruments that trend exponentially.
Why it’s different
Most channels draw fixed ±1σ and ±2σ around a regression line. This tool adds:
- Fibonacci-spaced σ divisions for precise scaling
- An objective MaxEnvelope of actual extremes with optional 1.272 and 1.618 extensions
- Pearson’s R labelling that classifies the trend as Strong Up, Moderate, Weak, or Strong Down
- A log-space option so channels behave correctly on long trends and high beta charts
How it works
Base line
- Linear regression of the last Length bars, drawn as a ray.
- Optional colour change by regime using Pearson’s R.
Divisions (StdDev or MaxEnvelope)
- StdDev basis: σ of residuals around the regression line.
- MaxEnvelope basis: distances from the base line to the farthest highs and lows in the lookback.
- Divisions can be Fibonacci multiples (0.382, 0.618, 1.000, 1.272 by default) or uniform steps.
Outer rails
- ENV 1.0 touches the farthest highs and lows within the window.
- Optional extensions at 1.272 and 1.618 highlight stretch and breakout zones.
Trend quality (Pearson’s R)
- R is computed on the same series and window.
- Default thresholds: Strong when |R| ≥ 0.70, Weak when |R| < 0.40.
- The label reads: R 0.XXX • Class, plotted near the most recent base value.
Log-space math
- When enabled, the model runs on ln(price) and converts the outputs back to price.
- Safer on multi-year charts and large percentage trends.
Presets
- Swing: Length 125, StdDev basis, Fib divisions, ENV 1.0 and 1.272 on
- Intraday: Length 240, StdDev basis, simple ±1 and ±2 style divisions, ENV off by default
- Position: Length 200, StdDev basis, compact Fib set for higher timeframes
You can turn preset overrides off to make every input respond instantly.
Inputs you will actually use
- Length, Source, Log-space ON or OFF
- Basis: StdDev or MaxEnvelope
- Divisions: Fib list or Step and Max multiple
- Outer rails: show ENV 1.0, show 1.272, show 1.618
- Labels and sizes, extend left or right
- Hide divisions or outer rails automatically when the regime is Weak
Alerts included
- Close crosses above or below ENV 1.0
- Close crosses above or below ENV 1.272 and 1.618 (if enabled)
Practical playbook
Trend following
- In Strong Uptrend: buy pullbacks near 0.382 to 0.618 above the base with stops just beyond the next lower division.
- In Strong Downtrend: sell bounces into 0.382 to 0.618 below the base with stops just beyond the next upper division.
Mean reversion
- When R is Moderate or Weak, fade moves that tag ENV 1.0 back toward the base.
- If price closes through an ENV extension, treat it as potential regime change and stand down on fades.
Breakouts
- A close through ENV 1.0 with R rising toward Strong often precedes trend acceleration.
- Use the next division or the 1.272 rail as the first target and trail on the base.
Tips
- Keep Length stable across symbols you compare. Consistency beats curve fitting.
- Use log-space on multi-year equities and crypto. Use linear for short intraday work.
- If you want a classic look, disable Fib and rails, set Step 1.0 and Max 2.0.
Notes
- The tool draws more lines when Fib divisions are active. If it feels busy, show divisions only and hide labels, or keep ENV 1.0 plus one extension.
- Pearson’s R is descriptive, not predictive. Combine with price structure and volume for entries.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.