Raff Regression Channel Node

The Raff Regression Channel fits the same straight line as the Linear Regression Channel but puts its edges at the farthest price in the window, so every body (or wick) fits inside. How it differs, its settings, and why it has no breakout outputs.

NodeBy AlgoLiftUpdated 6 min read
On this page 9How it worksWhy there's no breakout outputTouchesExample: buy the break of a falling channelSettingsOutputsUse something else whenWhen it doesn't behaveGoing further

A standard deviation channel expects price to poke outside it now and then. The Raff Regression Channel takes the opposite view. It fits the same best-fit line through the last N bars, then pushes its edges out to the farthest candle in the window, so the channel holds the whole trend. Its edges are the trend's own extremes, and price testing one is price testing the furthest it has gone.

Takes
Nothing. It reads its series' candles
Gives
A trend line with edges at the window's extremes, plus its slope, width, fit and touches
Reach for it
You want a trend's outer limits, not its statistical spread

How it works

The midline is fitted exactly as in the Linear Regression Channel: a least-squares line through the Midline Source (the close by default) over Lookback Bars. Only the width is different. Instead of counting standard deviations, the node looks at every candle in the window, measures how far it reaches above and below the line, and sets the edges at the farthest reach.

Boundary decides what a reach is. Candle Bodies, the default, measures from the top and bottom of each body, so wicks can stick out past the edges. Candle Wicks measures from the highs and lows, so nothing in the window crosses the channel.

Symmetry decides how the two sides relate:

SymmetryUpper edgeLower edgeMidline
Symmetric (default)Line plus the larger of the two reachesLine minus the same distanceThe regression line
AsymmetricLine plus the farthest reach aboveLine minus the farthest reach belowHalfway between the edges

Mind the last column. In Asymmetric mode the midline is the middle of the channel, not the regression line, so it can sit above or below the fit. Slope is the regression line's slope in both modes. For the same lookback and source, Slope and R-Squared (Fit) come out exactly as they do on the Linear Regression Channel; only the edges and the width differ.

As with the other channel, every line comes twice. The Completed lines are the channel at the last completed bar. The Projected lines, marked (Live), extend it one bar into the bar that's forming. Compare Current Price with the Projected ones.

Why there's no breakout output

The channel is drawn to contain its window, and the window includes the bar that just closed. With Candle Bodies, that bar's close is inside the completed channel by construction; with Candle Wicks, the whole bar is. A close beyond a channel it helped draw can't happen, so this node has no Breakout Above or Below.

To catch a break, ask about the bar that's forming instead. Projected Upper Band (Live) is the channel carried one bar ahead, so price trading above it has gone further from the trend line than anything in the window. For the moment it happens, use a Crossover on the Intrabar clock.

Touches

Touched Upper Band is true for the bar after a candle whose high reached the upper edge, and Touched Lower Band likewise for a low. What that means depends on Boundary. With Candle Bodies, it's a wick reaching past the farthest body in the window. With Candle Wicks and no tolerance, it fires only when the bar that just closed is the one that set the edge: the trend has printed a new extreme relative to its own path. Touch Tolerance (a share of the channel's width) relaxes both.

The touch counts work as on the Linear Regression Channel: touches across the window against the current edges, counted once per pullback under Retrace Required, or every bar under Raw (Every Bar).

Example: buy the break of a falling channel

Say you trade NQ 15m and watch for downtrends that end in a break: price getting further above the falling trend line than any bar in the last 50 managed.

Add a Raff Regression Channel with Lookback Bars at 50, Boundary on Candle Wicks so the edges are the true extremes, and Symmetry on Symmetric. Wire Slope into a Comparison, Less Than a Constant of 0, so the channel is falling. Wire Current Price into a of a Crossover and Projected Upper Band (Live) into b, direction Above, on the Intrabar clock. AND the two through a Logic node into a long Entry, and measure the Bracket Order's stop from the Signal bar, 2 points under its low.

The entry fills on the first trade above the projected edge, even if that bar later closes back inside.

Settings

Load Preset has four starting points: Standard Symmetric Raff (the defaults), Asymmetric Body Extremes, Fast Breakout Raff (Fuzzy) with 20 bars and a 5% tolerance, and Macro Asymmetric Raff with 100 bars, the OHLC/4 average, wick edges and an 80% reset.

Lookback Bars
Default 50
How many completed bars the line is fitted to, and the window the edges must contain. The editor's slider runs from 5 to 999.
Midline Source
Default Close Price
The price the line is fitted to: Close Price, Typical (HL/2), Typical (HLC/3) or Average (OHLC/4).
Boundary
Default Candle Bodies
What the edges reach for: Candle Bodies (open and close) or Candle Wicks (high and low).
Symmetry
Default Symmetric
Symmetric puts both edges at the larger reach. Asymmetric gives each side its own.
Touch Logic
Default Retrace Required
Retrace Required counts a touch, then waits for a pullback before counting another. Raw (Every Bar) counts every bar that touches.
Retrace to Reset
Default 50%
How far price must pull back into the channel, as a share of its width, before another touch counts. Unused on Raw.
Touch Tolerance
Default 0%
How close to an edge still counts as a touch, as a share of the channel's width.

Outputs

Projected Midline (Live)
Number
The midline extended into the forming bar.
Projected Upper / Lower Band (Live)
Number
The edges extended into the forming bar. The ones a live break is measured against.
Completed Midline
Number
The midline at the last completed bar: the regression line when Symmetric, the channel's middle when Asymmetric.
Completed Upper / Lower Line
Number
The edges at the last completed bar.
Touched Upper / Lower Band
True or false
True for the bar after a candle's high (or low) reached the edge.
Slope
Number
The regression line's rise per bar, in points.
Channel Width
Number
Upper edge minus lower edge, in points.
R-Squared (Fit)
Number
From 0 to 1, how well the line fits the window's prices.
Top / Bottom Touch Count
Number
How many touches of each edge across the window.

Use something else when

Breakout signals on a close
Its bands don't have to hold every bar, so a close can land outside them, and it has Breakout Above and Below for exactly that.
Flat lines at the highest high and lowest low
No trend line at all, only the window's extremes.
A level for a rule, like the 50-bar high
A single level from past bars is Price History's job.

When it doesn't behave

I can't find a breakout output

There isn't one, and it isn't an oversight: the completed channel always contains the bar that just closed. Compare Current Price with Projected Upper Band (Live), or use an intrabar Crossover on it, as in the example.

One spike makes the channel huge for 50 bars

The farthest point sets the width, so a single news bar stretches the channel until it leaves the window, Lookback Bars later. Candle Bodies shrugs off a spike that was mostly wick. If one bar shouldn't dominate, the Linear Regression Channel's width is an average over the window instead of a maximum.

The touch counts are always 0 or 1

That's Candle Wicks with no tolerance. Only the bar that set the extreme sits on the edge, so there's little else to count. Give Touch Tolerance a few percent (the Fast Breakout preset uses 5%) or switch Boundary to Candle Bodies, where wicks can reach past the edges.

The midline isn't on the regression line

Symmetry is set to Asymmetric, where the midline is the middle of the two edges. Switch to Symmetric if you want the fitted line itself.

Going further

Raff's width is an honest measure of the trend's worst excursion, which makes it useful beside the Linear Regression Channel rather than instead of it. A Raff channel much wider than a 2-deviation channel on the same window suggests one or two bars went far outside the usual scatter; one close to it suggests the trend has been unusually tidy.

The settings that matter (lookback, boundary and symmetry) are choices about what you think a trend's edge is, so make them before you look at results. Channels sweep through presets: save each version you want to compare as one, keep the list short, and remember that each one tested counts as another strategy tried.

Or ask the copilot