100% Free Downloads · No Hidden Costs Trusted software catalog since 2020
All Categories Antivirus & Security Developer Tools Games Internet & Browsers MQL5 Multimedia Office & Productivity Utilities

KS Zigzag Channel

by MQL5

★★★★★ Trusted download · 0 downloads
  • Version 1.20
  • Works on MT5
  • Free Trial — no cost to download
  • Direct download link, no installer bundling
MQL5 1.0 Mb

Product description

KS ZigZag Channels indicator is a MetaTrader 5 (MQL5) custom indicator.

It draws zigzag-style pivot lines connecting significant swing highs and lows, along with channel-like extremities (upper and lower deviation bands) around each zigzag segment. The goal is to filter out market noise, highlight the underlying trend structure, and provide dynamic support/resistance-like zones based on historical price deviation from the main zigzag line.
Core Logic & Detection Method

Unlike classic percentage- or point-based ZigZag indicators, this version uses a rolling window approach (controlled by the Length input, default = 100 bars):

It tracks a state machine (g_os[] buffer: 0 = looking for potential top / upward leg, 1 = looking for potential bottom / downward leg).
A new bottom pivot is confirmed when the close price Length bars ago drops below the lowest close in the last Length bars (after previously being in an "up" state).
A new top pivot is confirmed when the close price Length bars ago rises above the highest close in the last Length bars (after previously being in a "down" state).
This creates retrospective (backpainting / repainting) pivots — meaning historical pivot points can shift as new data arrives.

What is drawn on the chart

For each confirmed swing segment (between two consecutive pivots of opposite type):

Mid line (solid, orange-ish by default = MidColor): connects the previous pivot price → current pivot price → This is the main ZigZag line.
Upper extremity (dotted, red-ish = UpperColor): parallel line shifted upward by the maximum deviation observed during that segment → Maximum upward distance from any bar's high/close to the interpolated mid line.
Lower extremity (dotted, blue = LowerColor): parallel line shifted downward by the maximum downward deviation → Maximum distance from the interpolated mid line down to any bar's low/close.

These three lines together form a channel around each historical zigzag leg.

Small circles/arrows (dodger blue) mark the exact pivot points (highs/lows used).
Optional price labels appear at pivots when ShowLabels = true.

Last segment — extension feature

When ExtendLast = true (default), the indicator extends the most recent channel forward to the current bar:

It anchors from the last confirmed pivot of the same direction as the current leg.
It calculates a linear interpolation from that anchor pivot price → current close.
It then computes the max upward/downward deviation across all bars in the current leg so far.
Draws extended mid + upper + lower lines (prefixed "KSZzE_") projecting to the right (ray = true).

This gives a dynamic, forward-projecting channel that traders often use to anticipate potential support/resistance or reversal zones in real time.
Main Inputs & Controls

Length (100): lookback period — higher = fewer but more significant pivots
ExtendLast (true): whether to project the unfinished leg forward
ShowExt (true): show upper/lower deviation lines (the actual "channels")
ShowLabels (true): display price labels at pivots
Three customizable colors for upper/mid/lower lines

Typical Usage

Identify major swing structure and trend direction
Use the channels as dynamic support/resistance zones (price often reacts near the upper/lower bands)
Apply Fibonacci, harmonic patterns, channels, or other drawing tools more easily between clear swing points
Spot potential reversals when price breaks or rejects the extended channel in the live segment

Note: Because it is retrospective and recalculates pivots, historical lines can move slightly (repaint) — typical behavior for most ZigZag-family indicators. It is best used in combination with other confirming tools rather than in isolation for live entries.

💬