Gann Swing Chart Overlay
Gann's swing chart method predates the zigzag indicator by decades and works on bar structure rather than a percentage or point threshold. Each bar is compared to the one before it: a higher high with a higher low is an Up bar, a lower high with a lower low is a Down bar, a bar fully contained inside the previous range is Inside, and a bar that exceeds the previous range on both sides is Outside. The swing direction extends while bars keep confirming it and only reverses once InpConfirmBars bars in a row confirm the other direction - InpConfirmBars = 1 gives the traditional 1-bar swing chart, 2 gives the steadier 2-bar variant Gann traders also used to cut down on whipsaw in choppy conditions. One honest gap worth naming: Gann's own writing does not give one settled rule for how an Outside bar should be treated, and different modern writers fill the gap differently. This build makes a specific, disclosed choice - an Outside bar can still extend the live swing's extreme if it makes a new high or low in that direction, but it does not itself count towards confirming a reversal - and says so plainly rather than presenting it as the one true Gann rule. A corner label tracks how many bars the average up-swing and down-swing have run for, plus the bar count of the swing currently in progress - useful context for judging whether the present move is already long by this symbol's own recent standards. Notes and limitations - A swing point is only plotted once InpConfirmBars opposing bars have closed after it - that delay is the cost of not repainting, and it means the most recent swing point can still be InpConfirmBars bars behind the current bar. - The Outside-bar rule is a disclosed, specific design choice, not a claim of Gann orthodoxy - see the full description above. - Statistics are computed only from swings confirmed since the indicator was attached (or since the chart's loaded history on first load); they are not persisted between terminal restarts. - Fully causal: swing points and statistics only update on the close of bar 1, never on bar 0.
Indicator · MT5 · v1.0 · Free
About Gann Swing Chart Overlay
Gann Swing Chart Overlay is an indicator for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Confirm bars, Show stats and Alerts. MQL source code included.
Files in the download: GannSwingChart.ex5, GannSwingChart.mq5, GannSwingChart.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Confirm bars | 1 | 1 = classic 1-bar swing, 2 = smoother 2-bar swing |
| Show stats | true | Show a swing-length statistics label in the corner |
| Alerts | true | Alert once per closed bar when a swing is confirmed |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Indicators.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: ZigZag · Alerts · MT5 Indicator · MQL5 Source Code