The gann levels indicator divides yesterday’s daily range into eighths and draws each one as a horizontal line. A pivot sits in the middle. Around it run the eighth, quarter, three-eighth, half and three-quarter levels, each in its own colour so you can name a line at a glance.
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 | 1: GannAnchor |
| Alerts | popup |
| Inputs | 12 |
Which plots exist
Horizontal lines, and no plot in the pane.
`GannAnchor` is a DRAW_NONE buffer that shows nothing.
`InpClrPivot` paints the middle line yellow.
Aqua marks the eighth, lime the quarter.
Orange marks three eighths and magenta the half.
Red marks the outer three-quarter pair.
- GannAnchor: hidden buffer

How the numbers arrive
Yesterday supplies the numbers
Three prices do it. The code reads yesterday’s daily high, low and close. Those give the pivot and the range. Everything drawn is a fraction of that one range.
Eighths of the range
The fractions are fixed. Each level is the pivot plus or minus a share of the range. The shares run 0.125, 0.250, 0.375, 0.500 and 0.750, which is where the Gann name comes from.
Where they get drawn
As chart objects. Each line is an OBJ_HLINE named with `InpPrefix` `”GANNLVL_”`. `InpExtendRight` keeps them running forward. `InpAnchorBars` `240` sets how far back the first set is anchored.
Making sense of the output
The pivot is the reference, not a signal.
Colour tells you which fraction a line is.
The half and three-quarter pair mark an unusual day.
Levels rebuild when a new daily bar closes.
A level held twice is worth more than one touched once.
`InpShowLabels` prints the name beside each line.
Alert channels in this build: popup, one message per closed bar.
`InpAlerts` is the single alert control and ships true. It raises a terminal message when a close crosses a level. There is no phone, mail or sound route in this build. The check runs on the closed bar.
Every Gann Levels Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
InpAnchorBars |
bars back to anchor first level set. Bars back to the first set, `240`. | 240 |
InpExtendRight |
extend lines to the right. Run lines forward, `true`. | on |
InpPrefix |
object name prefix. Object name prefix, `”GANNLVL_”`. | GANNLVL_ |
Display settings
| Setting | What it does | Default |
|---|---|---|
InpLevelWidth |
line width. Line thickness, `1`. | 1 |
InpShowLabels |
print label text on each level. Print each label, `true`. | on |
InpClrPivot |
PP color. Pivot colour, `clrYellow`. | yellow |
InpClrInner |
+/-0.125 zone. Eighth colour, `clrAqua`. | aqua |
InpClrQuarter |
+/-0.250 zone. Quarter colour, `clrLime`. | lime |
InpClrThree8 |
+/-0.375 zone. | orange |
InpClrHalf |
+/-0.500 zone. Half colour, `clrMagenta`. | magenta |
InpClrOuter |
+/-0.750 zone. | red |
Alert settings
| Setting | What it does | Default |
|---|---|---|
InpAlerts |
alert on level breach. Alert on a breach, `true`. | on |

Matching it to your chart
Levels come from the daily bar, so the chart only changes how you see them. EURUSD H1 is the reference chart. A day of bars fits between two levels there. On M5 the lines sit far apart. On daily bars they crowd each bar.
When not to trust the output
One quiet day makes every level too close together.
One news day makes them all too far apart.
The fractions are fixed and the market does not know them.
Lines drawn as objects survive a chart change, so old ones can linger.
Copy the compiled Gann Levels 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.
Background reading on the method behind the Gann Levels Indicator: Gann angles on Wikipedia, Pivot Points at BabyPips.
Download the Gann Levels Indicator for MT4 and MT5
The zip holds the compiled Gann Levels 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 InpAnchorBars 240 anchor?
How far back the first level set gets placed. Two hundred and forty bars is ten days of H1 trade, which is enough to see whether the levels held before. It does not change the arithmetic of any level.
Which range do the InpClrQuarter lines divide?
Yesterday’s daily high minus its low. Every fraction, including the quarter pair in lime, is a share of that single figure. Nothing on your chart timeframe feeds the calculation.
Why does InpPrefix matter?
Because every line is a chart object, and the prefix keeps the names apart. Change it and a second copy can run on the same chart without either one deleting the other’s lines.
Does InpExtendRight change any level?
No, only how far the line is drawn. The prices stay where they are. Switching it off leaves shorter segments, which some traders prefer on a busy chart.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Gann Levels Indicator as one input. Always backtest before trading live.
Category: this is part of our Support and Resistance collection. Then, plainly, browse more Support and Resistance for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- The core method is documented in Rollover (foreign exchange) on Wikipedia.
- Additional market context is at B Indicator at StockCharts ChartSchool.
