OPEN-SOURCE SCRIPT

Standard Deviation Channel Updated

519
This is a updated script . The code was open source - courtesy leojez



---

**Title:** Standard Deviation Channel (with "Freeze" Toggle)

**Description:**

Linear Regression and Standard Deviation Channels are fantastic for identifying trends and mean-reversion levels, but they have one major flaw for day traders: **they constantly shift and repaint with every new price tick.**

This script solves that problem by introducing a custom **"Freeze Channel"** toggle.

Instead of chasing a moving target, you can now lock your channel in place and project static, reliable levels forward to trade against.

**Key Features:**

* **Freeze Toggle:** Stop the channel from shifting. You can choose to lock it to the last closed bar (ignoring live tick volatility) or lock it at a specific historical time (like the morning open) to establish fixed levels for the rest of the day.
* **Dual Deviations:** Independently toggle and customize multipliers for both inner (+/- 1) and outer (+/- 2) deviation bands.
* **Pearson's R:** Optional toggle to display the Pearson correlation coefficient to gauge the strength of the trend.
* **True-Level Alerts:** Custom alerts for upper and lower line breaks. The alerts use `line.get_price()`, meaning they trigger precisely based on where the lines are currently drawn on your screen—whether the channel is actively shifting or frozen in place.
* **Visual Customization:** Full control over line colors, fills, and left/right line extensions.

**How to Use the Freeze Feature:**
Go to the indicator settings and check "Freeze Channel".

1. Select **"Lock to Last Closed Bar"** to stop the live candle from wildly altering the channel slope.
2. Select **"Lock to Specific Time"** and enter a timestamp to anchor your channel permanently to a specific historical moment, extending those exact levels into the future.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.