Gann fans measure time against price. Fibonacci grids measure price alone. The gann fan and fibonacci indicator anchors both to one confirmed pivot, which is what makes them comparable: where a fan line crosses a retracement level, two independent methods point at the same spot.
This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 2: Pivot High, Pivot Low |
| Alerts | popup |
| Inputs | 11 |
What the file declares
Two arrow plots plus two grids of objects.
`Pivot High` uses arrow 234 in red.
`Pivot Low` uses arrow 233 in lime.
`InpFibColor` draws the retracement levels dodger blue.
Fan lines run orange upward and medium purple downward.
Object names all begin with `InpObjPrefix`.
- Pivot High: arrow, red, width 2, arrow code 234
- Pivot Low: arrow, lime, width 2, arrow code 233

Following the source
One anchor for both
`InpSwingLookback` `20` bars either side must fail to exceed a bar before it counts as a pivot. `InpScanBars` `220` limits how far back the search for the active one reaches.
The fan
Time enters here. `InpGannPipsPerBar` `1.0` sets how much price one bar is worth, which defines the 1×1 line. Every other fan line is a ratio of that slope.
The grid
Price only. Standard retracement fractions span the move from the anchoring pivot, drawn as horizontal lines that need no time scale at all.
Reading the output
The fan slopes, the grid does not.
A crossing of the two is where both methods agree.
`InpGannPipsPerBar` is the setting that matters most.
It must suit the symbol or every fan line is wrong.
Both grids re-anchor when a new pivot confirms.
`InpDrawFib` and `InpDrawGann` show either alone.
Alert channels in this build: popup, one message per closed bar.
A newly confirmed pivot is the reported event, since that is when both grids re-anchor. `InpAlertsOn` is the only switch over it and ships on. Messages land in the terminal, which is the sole destination this build offers.
Every Gann Fan and Fibonacci Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
InpSwingLookback |
Swing detection lookback. Bars either side defining a pivot, `20`. | 20 |
InpScanBars |
Bars scanned for active pivot. History searched for the active pivot, `220`. | 220 |
InpGannPipsPerBar |
Price units per bar for 1×1 (in pips). Price units one bar is worth, `1.0`. | 1.0 |
InpObjPrefix |
(see inputs panel) | GFF_ |
Display settings
| Setting | What it does | Default |
|---|---|---|
InpDrawFib |
Draw Fibonacci levels. Draw the retracement grid, `true`. | on |
InpDrawGann |
Draw Gann fan lines. Draw the fan, `true`. | on |
InpArrowOffsetPips |
Arrow vertical offset (pips). Pips between a pivot mark and its bar, `18`. | 18 |
InpFibColor |
Retracement line colour, `clrDodgerBlue`. | dodger blue |
InpGannUpColor |
Rising fan colour, `clrOrange`. | orange |
InpGannDnColor |
Falling fan colour, `clrMediumPurple`. | medium purple |
Alert settings
| Setting | What it does | Default |
|---|---|---|
InpAlertsOn |
Alerts on new pivot. Whether a new pivot reports, `true`. | on |

Home chart
A twenty-bar pivot rule needs a chart where swings last. EURUSD H1 is the reference chart, where a pivot holds for days. Drop to M5 and the anchor moves constantly. Move to H4 and the scan reaches back two months.
The catch
A fan is only as good as its price-per-bar setting.
That setting has no correct value, only a chosen one.
A twenty-bar pivot confirms twenty bars late.
Two grids at once is a great deal of chart furniture.
Copy the compiled Gann Fan and Fibonacci Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.
Related on forexmt4systems.com: Fibonacci Retracement Strategy.
Background reading on the method behind the Gann Fan and Fibonacci Indicator: Gann angles on Wikipedia, Fibonacci Fan at BabyPips.
Download the Gann Fan and Fibonacci Indicator for MT4 and MT5
The zip holds the compiled Gann Fan and Fibonacci Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.
Download this indicator free
Enter your email and the file is yours. You also get the full MT4 and MT5 library.
FAQ
What does InpGannPipsPerBar 1.0 define?
The 1×1 line, which is the backbone of the fan. It says one bar of time equals one pip of price, and every other fan line is a ratio of that slope. Get it wrong for the symbol and the whole fan is meaningless.
Why anchor the fan and grid to the same pivot?
So the two can be compared. A fan line crossing a retracement level marks a point where a time-based and a price-based method agree, and that only means something when both start from the same origin.
How late does InpSwingLookback 20 confirm?
Twenty bars. The high or low sits where it always did, but twenty bars have to print on the far side before it counts, so both grids appear well after the pivot they anchor to.
Can InpDrawFib and InpDrawGann run separately?
Yes, they are independent switches, so either grid can be turned off. On a busy chart running one at a time is usually easier to read than carrying both sets of objects together.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Gann Fan and Fibonacci Indicator as one input. Always backtest before trading live.
Category: this is part of our Oscillators collection. Also, truly, browse more Oscillators for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- Learn more about the underlying method in Gann angles on Wikipedia.
- For wider market background, see Introduction To Technical Indicators And Oscillators at StockCharts ChartSchool.
