Linear Regression Trend Channel with Entries & Alerts
Aug 28, 2020

The Linear Regression Trend Channel with Entries & Alerts indicator identifies price trends and potential reversal points by projecting a linear regression channel over a user-defined period. This tool helps traders visualize the mean price movement and statistical deviations, providing clear entry zones based on channel extremes.
Usage
The tool is primarily used to identify overextended price conditions. When the price reaches the upper channel boundary, it may indicate a potential sell opportunity, while reaching the lower boundary suggests a potential buy opportunity.
The indicator features information panels that display both the current and previous entry levels, making it easier to track changes in the trend structure. Traders can use the extension settings to project the channel forward, assisting in identifying future support and resistance levels.
Details
The script calculates the best-fit line (linear regression) for a specified number of bars using the least squares method. It then determines the standard deviation of prices relative to this line. The channel is formed by shifting the median line up and down by the user-defined multiplier of the calculated standard deviation. This statistical approach ensures the channel dynamically adapts to the volatility of the asset.
Settings
Channel Parameters
- Period: The number of bars used to calculate the linear regression and standard deviation.
- Deviation(s): The multiplier applied to the standard deviation to set the width of the upper and lower channels.
- Extend Method: Determines if the channel lines are extended to the right or remain fixed on the current calculation period.
Visuals
- Upper Channel Color: Sets the color for the upper deviation line.
- Middle Channel Color: Sets the color for the median regression line.
- Lower Channel Color: Sets the color for the lower deviation line.
- Display info panels?: Toggles the visibility of the price labels on the right side of the chart.
- Linear Label Offset: Adjusts the horizontal position of the information panels.
- Linear Label Size: Changes the text size of the information panels.
- Look Back: Defines the historical bar reference for the "Previous Entry" calculation shown in the panels.
FAQ
How do I use the alerts for this indicator?
You can set alerts for price crossing the upper or lower boundaries. The script includes predefined alert conditions for "Sell Alerts" (crossing the upper line) and "Buy Alerts" (crossing the lower line).
What does the "Look Back" setting do?
The Look Back setting determines which previous bar's channel value is displayed in the info panel as a reference point for recent price action.
How can I access Linear Regression Trend Channel with Entries & Alerts?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.