Linear Regression Channel fits a least-squares line through the last N closes and draws four bands around it, at one and two standard errors either side.

It is the simplest thing I sell, it is MT5 only, and it has no signals and no alerts. If you want something that tells you when to act, this isn't it. If you want a correctly implemented regression channel with the maths described rather than hidden, read on.

EURUSD H4: the regression line in blue, one standard error in yellow, two in red

What it computes

A textbook ordinary least-squares fit. Over Channel Period bars, default 150, it accumulates the sums of x, y, xy and x² and solves for slope and intercept in one pass. The applied price is the close.

Then it walks the same window again and totals the squared distance between each close and the fitted line. The square root of that, divided by the bar count, is the standard error. That single number sets every band: the inner pair sit one standard error above and below the line, the outer pair sit two.

So the channel width is not a setting. It's a measurement of how badly the line fits, which means a market that trended cleanly gets a narrow channel and a choppy one gets a wide channel, automatically and without a multiplier to tune.

Channel Period is the only input that changes the result.

The thing nobody says about regression channels

The entire channel is refitted from scratch on every new bar.

That is not a defect and it is not specific to this implementation. It's what a regression channel is: the best fit through the last N bars, and the last N bars are different bars tomorrow. But it has a consequence people trade against without noticing.

The line you saw yesterday is not the line on your chart today. As the window rolls forward, an old bar drops out of the left of the window and a new one joins on the right, and the whole fit pivots. A touch of the lower band that looked significant three bars ago may be nowhere near the band as it stands now, because the band moved.

Read this as a description of the current window's shape, not as a level with memory. If you want levels that hold still, the tools built on ratchets and pivots in the rest of the range do that deliberately; this one does the opposite by design.

Gold H1: the same five lines, and how much of the fit window sits off the left of the screen

What you get

Five plotted buffers: the regression line, the ±1 standard error pair, and the ±2 pair. All five are readable through iCustom, which makes this one of the more useful things in the range to build on, precisely because it is plain.

The channel is drawn only across its own window. Bars older than Channel Period are left empty rather than extrapolated, which is why the lines stop partway back on a scrolled chart.

There is an input guard worth knowing about: if you set Channel Period larger than the bars available, it silently reduces the period to what exists and prints a note in the Experts log. It doesn't fail and it doesn't warn on the chart.

Typical channel indicator This
Band width A multiplier you tune The standard error of the fit itself
Inputs Several One that matters
Signals Arrows, alerts None at all
Readable by an EA Rarely Five buffers
Refit Every bar Every bar, and the listing says so

Where it's weak

No signals, no alerts, no notification block. The MQL5 listing for this carries "with signal" in its title. This build does not have one, so I've named it for what it does. It draws five lines.

MT5 only. There is no MT4 build of this one.

The slope correction in the deviation formula is effectively inert. The source divides the standard error by a cosine term intended to widen the bands on steep slopes. The units don't line up: a price-per-bar slope is fed through a degrees-to-radians conversion twice, so for any realistic slope the divisor evaluates to approximately one. The bands you get are the plain standard error. I'd rather tell you that than let you believe there's an angle correction doing work.

One standard error is not a probability band. It's a dispersion measure of the residuals, and the residuals of a trending market are not normally distributed. Treating a two-sigma touch as a rare event is reading more into it than the arithmetic supports.

It recomputes only on a new bar. The channel does not move intrabar, which is good for stability and means the current bar's position relative to the band is stale until the bar closes.

No repaint protection to speak of, because there's nothing to protect. Historical values are recomputed each new bar along with everything else. This is inherent to the method.

Questions you'll have

Does Linear Regression Channel repaint? In the sense that matters, yes, and every regression channel does. The whole fit is recalculated on each new bar, so historical line values change as the window rolls. Nothing is being hidden from you; that is what fitting a line to a moving window means.

How do I make the channel wider or narrower? You don't, directly. The width is the standard error of the fit. Change Channel Period and the fit changes, and the width follows.

Why does the channel stop partway back on my chart? It is only drawn across its own window, Channel Period bars ending at the current bar. Older bars are deliberately left empty.

What are the two pairs of bands? One standard error and two standard errors either side of the regression line.

Does it have signals or alerts? No. It draws five lines and nothing else.

Is there an MT4 version? No, this one is MT5 only.

Can an EA read the channel? Yes, all five lines are plotted buffers, so iCustom gets the regression value and all four band levels.

Why did my Channel Period setting change itself? If you asked for more bars than the chart has, it reduces the period to fit and prints a line in the Experts log.

Best timeframe? Anything from M15 up. The period is in bars, so 150 bars means two and a half days on H1 and a month on H4, and that choice matters more than the timeframe itself.

Support

Send me a message with a screenshot, the symbol and the timeframe, and I'll tell you what the tool was doing on that bar.

Analysis tool. It places no trades and makes no profitability claim. Past price behaviour is not a guide to future price behaviour.