The auto trend lines channels indicator fits a straight line through the last RegLookback closes and builds a channel around it. Regression mid is that fitted line. Upper and Lower sit a multiple of the fit error either side, so the channel width reflects how well price has actually followed the line.
This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 3: Regression mid, Upper, Lower |
| Alerts | popup, push notification, email, sound |
| Inputs | 8 |
What the Auto Trend Lines Channels Indicator draws on the chart
Regression mid is the least squares straight line fitted across the lookback window.
Upper sits Mult residual deviations above that line.
Lower is the same distance below.
All three redraw across the whole window whenever the fit updates, since a regression describes the window rather than each bar in turn.
- Regression mid: line, gold, width 2
- Upper: line, silver, width 1
- Lower: line, silver, width 1

How the Auto Trend Lines Channels Indicator calculates its values
Fitting the line
Running totals of the bar positions, the closes, their products and the squared positions give the two numbers a least squares fit needs.
Dividing through produces a slope and an offset. Together they define a value for every bar inside the window rather than only at its newest end.
Width from the fit error
Once the line exists, the code measures how far each close sat from it, squares those distances, averages them across the window and takes the square root.
That figure is the typical miss. Multiplying by Mult sets the channel width, so a window price tracked closely gives a narrow channel and a scattered one gives a wide channel.
Why this differs from a band
A deviation band measures scatter around a flat average, so it cannot describe a sloping market without widening.
Here the scatter is measured around a sloping line, which means a steady trend produces a narrow channel rather than a wide band.
How to read the signals
Channel slope is the trend of the window, measured rather than eyeballed.
A narrow channel means price followed the line closely across the whole lookback.
Price at Upper has stretched Mult typical misses above the fit, which is a different statement from being far from an average.
The whole channel shifts when the window rolls, so a level from yesterday is not the level today.
Alert channels in this build: popup, push notification, email and sound.
Alerts cover popup, push, email and sound. This build carries no once-per-bar guard, so a condition can alert more than once while a bar is still forming.
Every Auto Trend Lines Channels Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
RegLookback |
RegLookback is how many bars the line gets fitted through. It defaults to 100. Shorter windows track price harder and reslope more often. | 100 |
Mult |
Mult is how many typical misses each edge sits from the fitted line, 2.0 by default. Raising it towards 3.0 makes touches rare. | 2.0 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
EnableAlerts gates the message block and defaults to true. | on |
EnablePopup |
(see inputs panel) | on |
EnablePushNotify |
(see inputs panel) | off |
EnableEmail |
(see inputs panel) | off |
EnableSound |
EnableSound plays a file from the MT4 Sounds folder. It defaults to false. | off |
SoundFile |
(see inputs panel) | alert.wav |

Settings that fit your chart
The screenshot uses EURUSD H1. A hundred bars on H1 covers about four trading days, long enough for a slope to mean something. On H4 the same window spans weeks. Below M15 the fit reslopes constantly and the channel loses the stability that makes it worth drawing.
When the Auto Trend Lines Channels Indicator fails
A straight line cannot describe a window that turned in the middle. The fit splits the difference and the channel ends up describing neither leg.
Every value in the window can change when the window rolls forward, so this is a description of the past rather than a level that holds.
Extending the channel beyond its window is guesswork the calculation never did.
A single outlier close inflates the squared error and widens the whole channel.
Copy the compiled Auto Trend Lines Channels Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.
Background reading on the method behind the Auto Trend Lines Channels Indicator: Price Channels at StockCharts ChartSchool, The Elliott Wave Theorist on Wikipedia.
Download the Auto Trend Lines Channels Indicator for MT4 and MT5
The zip holds the compiled Auto Trend Lines Channels Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.
Download this indicator free
Enter your email and the file is yours. You also get the full MT4 and MT5 library.
FAQ
How does the Regression mid channel differ from a deviation band?
A band measures scatter around a flat average, so a trending market pushes it wide. Here the scatter is measured around a sloping fitted line, so a steady trend produces a narrow channel. The width reports how well price followed the slope, not how far it travelled.
What does Mult 2.0 measure the distance in?
Typical misses from the fitted line. The code squares each close’s distance from the line, averages those across the window and takes the square root. Mult multiplies that figure, so 2.0 puts each edge two typical misses away.
Does the Regression mid line move once it is drawn?
Yes, across its whole length. A regression describes the window as a unit, so when the window rolls forward the slope and the width both update and every plotted value can shift. Treat it as a current description rather than a fixed level.
Should RegLookback be shorter than 100 on a fast chart?
Usually the opposite. Shorter windows reslope constantly, which is exactly what makes a fast chart hard to read. Keeping RegLookback long gives the channel enough history to stay still between updates.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Auto Trend Lines Channels Indicator as one input. Always backtest before trading live.
Category: this is part of our Trend collection. Thus, truly, truly, browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- The core method is documented in Price Channels at StockCharts ChartSchool.
- Additional market context is at The Elliott Wave Theorist on Wikipedia.
