Attachments forums

Re: Gann Swing Chart for MT4

mazibee, Mon Jul 13, 2026 2:22 am

=====================================================================
GANN SWING CHART PRO for MT4 (GannSwingChartPro_v1.0)
=====================================================================
A classic W.D. Gann swing chart overlay with a live dashboard, higher-timeframe overlay and swing statistics.

My version using AI ---------------------------------------------------------------------
1. THE SWING RULES (what the indicator actually does)
---------------------------------------------------------------------
Classic 1-bar Gann swing chart:

- HIGHER BAR (higher high AND higher low) -> swing turns/stays UP
- LOWER BAR (lower high AND lower low) -> swing turns/stays DOWN
- INSIDE BAR (inside the previous range) -> ignored
- OUTSIDE BAR (engulfs the previous range) -> undecided, the indicator WAITS for the next directional bar to resolve it

Extras built in:
- EqualPips tolerance: a bar whose high/low misses the previous bar's level by only a couple of pips is treated as EQUAL, not as a reversal. This filters one-tick fake turns.
- Only CLOSED bars are used. The forming bar never flips the swing, so confirmed pivots do not repaint. Only the current developing leg extends as new bars close.

What is drawn:
- Stepped swing line : vertical + horizontal segments (up-legs and down-legs can have different colors)
- Orange dots : confirmed swing HIGHS
- Blue dots : confirmed swing LOWS
- Optional labels : pivot price, with the swing size in brackets, e.g. (223) 1.93619
- Gold/gray steps : the SAME swing logic computed on the next higher timeframe, drawn behind the chart
- Optional arrows : Gann TREND signals (see section 4)

---------------------------------------------------------------------
2. THE DASHBOARD
---------------------------------------------------------------------
Header buttons:
? opens a help panel beside the dashboard explaining every row [-] minimizes the dashboard to its title bar (+ restores it)
Hovering any row also shows its explanation as a tooltip.

Rows:
SWING: Current swing direction and how many CLOSED bars ago its pivot extreme formed.
LEG: Size of the developing leg from the last confirmed pivot to the running extreme (distance / bars).
FLIPS AT: The price that starts confirming the next swing turn: the reference bar's low (uptrend) or high (downtrend) +/- the EqualPips tolerance.
NOTE: this level RATCHETS with every new bar - treat it as a trailing trigger, valid until the next bar closes.
TREND: The QUALIFIED Gann trend. The trend only turns UP when price takes out the previous confirmed swing HIGH, and only turns DOWN when it breaks the previous confirmed swing LOW. The shown level flips it - unlike FLIPS AT, this level is FIXED until a new pivot confirms. This is the strongest number on the panel.
W1 SWING (or D1/H4... depending on chart) The higher-timeframe swing direction. ALIGNED = your chart swing agrees with it - the classic Gann filter is to trade only in that direction. COUNTER = you are against the higher TF.
AVG UP Average up-leg / down-leg size and duration over the AVG DOWN last N completed swings (default 20).
DN/UP Correction vs impulse ratio: average down-leg as a % of the average up-leg. Below 100% in an uptrend = healthy (corrections smaller than impulses). Above 100% = choppy, rallies are being fully retraced.
THIS LEG The current leg as a % of its same-direction average.
Green below 80% = leg is young, room to run
Black 80 - 120% = normal territory
Red above 120% = stretched, rotation risk (Gann's swing-exhaustion read)

Units: forex pairs show pips. Gold, indices and crypto automatically show price points instead (e.g. 1811 pts on DE40, 121.13 pts = $121 on ETHUSD). See UnitSize/UnitSuffix inputs to override.

---------------------------------------------------------------------
3. A SIMPLE GANN WORKFLOW
---------------------------------------------------------------------
1. Check W1 SWING on the dashboard. Trade only ALIGNED, or at least size down when COUNTER.
2. Wait for the chart swing to rotate into the higher-TF direction (blue up-leg forming after a swing low).
3. Enter on the TREND qualification: the arrow / the moment price takes out the previous swing high (trend up) or low (trend down).
Enable ShowTrendSignals to see these as arrows.
4. Initial stop: beyond the pivot that started the leg. Trailing idea: the FLIPS AT level follows the swing bar by bar.
5. Use THIS LEG %: entering when the leg is already 120%+ of average is chasing; look for the next rotation instead.
---------------------------------------------------------------------
4. MAIN INPUTS
---------------------------------------------------------------------
MaxBars History depth (0 = all bars)
SwingBars Consecutive bars needed to turn the swing (1 = classic; 2-3 = slower "main trend" charts)
OutsideMode WAIT (classic) or resolve outside bars by close
EqualPips Equal high/low tolerance in pips (default 3; set 0 for strict textbook rules)
UseCurrentBar Let the forming bar flip the swing (off = classic non-repainting behaviour, recommended)
UnitSize/Suffix Override distance units, e.g. UnitSize 0.1 + Suffix "pips" if you count gold in 0.10 pips
Up/DnLineColor Leg colors (set both the same for the classic single-color look)
ShowLabels Pivot price labels; LabelPips adds the swing size in brackets
ShowTrendSignals Arrows when price breaks the prior pivot HTFEnable/Period Higher-timeframe overlay; AUTO = next higher TF
ShowPanel/corner The dashboard and where it sits
StatsSwings How many completed swings feed the statistics
AlertPopup/Push Alert when a swing turn confirms (on bar close)

---------------------------------------------------------------------
5. GOOD TO KNOW
---------------------------------------------------------------------
- Confirmed pivots do not repaint. The developing leg (and its HTF equivalent) naturally extends until a turn confirms - that is how every swing chart works.
- Different brokers cut daily bars at different GMT offsets, so pivots can differ slightly between brokers on the same pair. That is the data, not the indicator.
- The dashboard state (minimized / help) resets when the indicator reloads or the timeframe changes.
- Works on any symbol and timeframe. On MN1 charts there is no higher timeframe, so the overlay row shows "n/a".

Happy trading,

Thanks to Firesword and Cagliostro.

Update:
I have learned so much from the free resources and the source available here so I am sharing the source as I believe that sharing is caring.
I hope seniors/ more experienced coders can enhance it further and share for the benefit of community.
All files in topic