Charts See the terminal

Regression Trend

A straight best-fit line through the closes of the last 100 bars with parallel bands above and below, showing the recent trend and how far price strays from it.

Live Regression Trend preview · BTC/USDT · Binance

What is Regression Trend?

Regression Trend fits one straight line through the closes of the most recent 100 bars using least squares, the line that keeps the squared distances from the closes as small as possible. It draws that line on the price chart, with dashed bands two standard deviations of the distances above and below it. The slope of the line is the average trend over that span, and the bands show how widely price has scattered around it.

The channel describes the span you choose as it stands now. It is drawn only once, across the latest bars, and is fitted again whenever a new bar arrives, so it moves with the chart. It is not a history of past values and does not forecast where price will go.

How to use Regression Trend

  • The slope. A line rising from left to right means closes have trended up over the span; falling means down; flat means no net trend.
  • Price against the middle line. Price above the line has been running ahead of the average trend; below it, behind.
  • Price at the bands. Closes near the upper or lower band are unusually far from the trend for this span. In a steady trend price often returns towards the line, but a strong move can carry it through a band and change the fit.
  • Width of the channel. A narrow channel means closes have hugged the trend; a wide one means they have been scattered.

These are ways to read the channel, not entry signals on their own.

Settings

SettingDefaultWhat it changes
Length100 Number of most recent bars the line is fitted to. Shorter describes a more recent trend and reacts sooner to each new bar; longer describes a broader trend. Minimum 3.
Deviations2 How many standard deviations of the distances from the line the bands are placed at. Higher widens the channel. Minimum 0.001, maximum 50.

Adjust the span and band width in the indicator settings.

Calculation

Over the last Length closes, numbered from 0 for the oldest to Length - 1 for the current bar, the indicator fits a least-squares line and measures the spread of the closes around it:

slope     = sum((x - mean x) * (close - mean close)) / sum((x - mean x)^2)
intercept = mean close - slope * mean x
line(x)   = intercept + slope * x
spread    = sqrt(sum((close - line(x))^2) / 100)
upper     = line + 2 * spread
lower     = line - 2 * spread

The spread is the standard deviation of the closes' distances from the line, divided by the number of bars rather than by one or two fewer. The middle line is drawn solid and the two bands dashed, each as a straight segment from the oldest bar in the span to the current bar.

The channel is calculated and drawn only on the latest bar. When a new bar arrives the span moves forward by one bar, the line is fitted again and the new channel replaces the old one.

Limitations

  • It redraws. The channel is refitted on every new bar and the previous one is removed, so its slope, position and width change as price moves. It cannot be used to see where the channel was on an earlier bar.
  • A straight line is an assumption. Fitting a line to a market that accelerated, reversed or ranged gives a slope that averages over very different behaviour.
  • The span decides the answer. The same chart can show an uptrend over 50 bars and a downtrend over 200. The result depends on the Length you choose.
  • The bands are not support and resistance. They are a measure of past scatter around the fitted line, and price can stay outside them during a strong move.
  • It uses the close only. Highs and lows play no part in the fit or the bands.

Frequently asked questions

Regression Trend is a channel drawn on the price chart. It fits a straight least-squares line through the closes of the most recent bars and adds bands a set number of standard deviations above and below it. The line's slope describes the trend over that span and the bands show how far price has strayed from it.

Read the slope for the direction of the trend over the span, the position of price against the middle line for whether it is ahead of or behind that trend, and the bands for how unusual the current distance is. Remember that the channel describes the latest span only and will change as new bars arrive.

Yes. The indicator declares two inputs: Length, default 100 with a minimum of 3, which sets how many recent bars the line is fitted to, and Deviations, default 2, from 0.001 to 50, which sets how far the bands sit from the line. Open the indicator's settings on the chart to change them.

Yes. The channel is fitted again on every new bar over the latest span and redrawn, replacing the previous channel. Its slope, position and width can all change from one bar to the next, so the channel you see now is not what was shown at earlier bars. It describes the current span, not a fixed history.

Standard Error Bands refit a regression on every bar and plot only the value at that bar, which leaves a curve through history. Regression Trend fits once across the whole span and draws the straight line itself, so it shows the trend over a chosen span rather than a rolling sample of it.

Use the Add to chart button at the top of this page. It opens BTC/USDT on Binance in the Altrady Charts terminal with the built-in Regression Trend already applied. On any other market, open the indicator picker on the chart and choose Regression Trend from the Trend group.

Add to chart