Loading…

Raff Regression Channel

A Raff Regression Channel is not the same construction as a standard deviation regression channel, even though both start from a least-squares line. Raff's method finds the single closing price that deviates furthest from the regression line, in either direction, and draws both parallel lines at that same distance - guaranteeing every close in the window sits inside the channel, rather than the roughly-68%-inside guarantee a one standard deviation band gives. That is the specific thing this indicator reproduces: the offset is a true maximum absolute deviation, computed by walking every close in the window, not an approximation. The window itself is anchored automatically to the most recent confirmed Williams fractal (a 5-bar swing high or low, confirmed once both bars after it have closed) rather than a fixed bar count typed in by the user. A fixed-count window regularly straddles two unrelated legs - half of one trend, half of the next - which produces a regression line that fits neither cleanly. Anchoring to the last real swing point means the channel always covers exactly one leg, the one currently in progress since that swing formed. The whole window is rebuilt on every tick, bounded by InpMaxLookback, so cost never grows with chart history the way an uncapped anchor search would. Notes and limitations - If no qualifying fractal exists within InpMaxLookback (e.g. very early in a short history), the indicator falls back to a plain fixed window of InpMinBars bars rather than drawing nothing. - The channel is recomputed from scratch every tick and is not a running series - older bars' channel values change retroactively whenever the anchor point changes. This is expected behaviour for an auto-anchored channel, not repainting of a signal. - Purely a visual reference tool. It draws no arrows, sends no alerts, and makes no prediction about where the current leg ends.

Indicator · MT4 · v1.0 · Free

About Raff Regression Channel

Raff Regression Channel is an indicator for MetaTrader 4. It has 2 settings, such as Max lookback and Min bars. MQL source code included.

Files in the download: RaffRegressionChannel.mq4, RaffRegressionChannel.txt.

Settings

SettingDefaultWhat it does
Max lookback300Furthest back, in bars, to search for the anchoring swing fractal
Min bars15Minimum bars between the anchor and the current bar - too short a window makes a meaningless channel

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the indicator from the Navigator onto a chart and adjust the settings.

Download the PDF guide

Tags: Fractals · Channels & Envelopes · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria