Linear regression channel
Two anchors that name a time range and nothing else.
The prices come from the bars, not from the anchors: the line is the least-squares fit through the closes in that range, and the two parallels sit at the largest distance any close in the range fell from it, so the channel contains every one of them. That is why a drag on this kind moves it in time only - an anchor's price places nothing. It is recomputed every frame from the same series the chart draws, so a bar that pages in or folds away moves the channel the way it moves the candles, and a range holding fewer than two bars fits nothing and falls back to the plain segment between the anchors. The last bar in the range may still be forming: its close is still moving, so the channel can change until that bar closes.
01The tool, live
Placed and drawn by Bentrix’s own code over the same synthetic bars on every page — an illustration of the tool’s geometry, not a market.
02Its parts, named
- 1Press on anchor 1
- 2Drag: a ghost of the whole tool follows the pointer
- 3Release on anchor 2
03What you see
A straight line fitted through the closes of a range of bars, with two parallels placed so that every close in the range lies between them. You choose only the range; the prices come from the bars.
The same fitted line, with parallels at the largest distance any close in the stretch fell from it — so the channel contains every close. Compare the linear regression channel study, which recomputes as each bar arrives.
It shows how the closes in that range scatter around their own straight fit.
04Where it comes from
Least-squares fitting is Gauss's and Legendre's, from around 1800. Gilbert Raff described the channel built on it for traders in 1991, which is why it is also called the Raff channel.
05How it is placed
- Open the chart's Tools column and choose Line tools › Linear regression channel.
- Press on the start of the range, drag to the end of the range, and release. A ghost of the whole tool follows the pointer while you drag.
- With the magnet on, an anchor dropped near a candle's open, high, low or close snaps to it.
Its anchors
- 1The start of the range
- 2The end of the range
Put the two anchors at the two ends of the stretch to be fitted.
06The geometry
Over the closes of the range:
m = (n Σ iCᵢ − Σ i Σ Cᵢ)/(n Σ i² − (Σ i)²), c = (Σ Cᵢ − m Σ i)/n, L(i) = c + m i
w = max ᵢ | Cᵢ − L(i) |, upper = L + w, lower = L − w
Dragging an anchor moves it in time only: an anchor's price places nothing.
07Settings and defaults
08Readings — what traders look for
Slope. The fitted line is a trend measured rather than drawn by eye; its direction and steepness are what readers take first.
Position inside the channel. Price near the upper parallel is far above the range's own fit, near the lower far below.
Leaving the channel after the range ends is read as behaviour the range did not contain.
09What it does not tell you
The fit describes the bars inside the range. Past the second anchor the lines are an extension, not a measurement.
10Limits and common misreadings
The range is yours. Start it one swing earlier and the slope changes.
One outlier sets the width, because the parallels sit at the largest distance.
It is refitted when the range moves, so it cannot be used to judge the bars that produced it.
11On other chart types
A drawing is fixed to moments and prices, so it keeps its place on every chart type. On a chart built by price or by activity — Renko, Range bars, Point & Figure, Kagi, Line break — each anchor stands on the brick, bar or column that holds its moment. No chart type refuses a drawing. In an indicator's own pane, the channel is fitted to that pane's main line instead of to the closes.
12In Bentrix
- Where it is: the chart's Tools column › Line tools › Linear regression channel.
- Its properties: select the tool and open its properties window; the small bar that floats beside a selected tool has its lock.
- Undo: Ctrl+Z takes back the last drawing step on that chart.
- In a pane: every tool can also be placed in an indicator's own pane.
13From an agent or a program
An agent or a program places the tool with object_place: the chart, the kind regression_channel, and its anchors in placement order, each a moment (t_ms, milliseconds since 1970 on the workbench's feed) and a price. Acting on a chart needs the lab permission, and tools that act are part of Plus.
{
"name": "object_place",
"arguments": {
"chart": "<chart uri>",
"kind": "regression_channel",
"anchors": [
{
"t_ms": 1710151200000,
"price": 1.085
},
{
"t_ms": 1710172800000,
"price": 1.0862
}
]
}
}object_move moves its anchors, object_change its look, object_find lists a chart's drawings and object_delete removes one. All of them are in the MCP reference, and every SDK language has the same calls.
15Sources
- Raff, Gilbert. "Trading the Regression Channel." Technical Analysis of Stocks & Commodities 9, no. 10 (1991).
- Kirkpatrick, Charles D., and Julie R. Dahlquist. Technical Analysis: The Complete Resource for Financial Market Technicians. 2nd ed., FT Press, 2010.
Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed