Loading…

Auto Parallel Channel

Most automatic channel indicators fit the second line independently, regressing it against its own set of points. That produces a line that looks statistically reasonable but is not what a trader drawing a channel by hand would actually do. The manual approach is simpler: draw the base trendline through two swing points, then find the single opposite swing that sticks out furthest from that line between the two anchors, and drag the parallel line through that one point. This indicator automates exactly that manual rule rather than a separate fit. The base line tries an uptrend first - the two most recent confirmed swing lows, provided the more recent one is higher than the one before it - and falls back to a downtrend fit through the two most recent confirmed swing highs if the lows are not rising. Confirmation uses the same rule as the other swing-based indicators in this catalogue: a bar only counts once it has held as the most extreme point within InpSwingBars bars on both sides, so the base line's anchors are always a few bars behind the current price by construction. The channel is only rebuilt once per newly closed bar, not on every tick, so it stays stable rather than jittering as price moves inside the current candle. MQL4 has no native filled-parallelogram chart object. When shading is turned on, the shaded area is drawn as a rectangle spanning the channel's time range at its price extremes - a bounding box, not a true parallelogram - which is exactly why it defaults to off: lines-only is an honest representation of the geometry, and the shade is offered as an optional approximation rather than the default. Notes and limitations - The channel only exists once two qualifying same-side swings and one opposite-side anchor point can be found; on a chart without a clean enough trend, no lines are drawn at all. - Both anchors are confirmed swings, so the channel is always a few bars behind the most current price action by construction - it describes the established trend, it does not predict where the next swing will land. - The shaded fill, when enabled, is a rectangle bounding box rather than a true parallelogram, because MQL4 has no native filled-parallelogram object. Lines-only is the more geometrically honest default. - Only one channel is tracked at a time. A new pair of qualifying anchors replaces the previous channel outright rather than keeping a history of past channels on the chart. - A sideways market with no clear rising sequence of lows or falling sequence of highs may leave the indicator with no valid base line to build from.

Indicator · MT4 · v1.0 · Free

About Auto Parallel Channel

Auto Parallel Channel is an indicator for MetaTrader 4. It has 7 settings, such as Swing bars, Base color and Parallel color. MQL source code included.

Files in the download: AutoChannel.ex4, AutoChannel.mq4, AutoChannel.txt.

Settings

SettingDefaultWhat it does
Swing bars5Bars required on each side to confirm a swing
Base colorclrLimeBase trendline colour
Parallel colorclrDodgerBlueParallel channel line colour
Line width2Line width
Extend bars60Bars to extend both lines to the right
Shade channelfalseShade the area between the lines (false = lines only)
Shade colorclrLavenderShade colour, used when InpShadeChannel is true

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: Channels & Envelopes · Trend · MT4 Indicator · MQL4 Source Code

MetaTrader 4 & 5 indicators · PolyMaria