Fibonacci Alert Indicator: Pivot Levels With A Popup

Written by Dominic Walsh · Published · Last updated

The fibonacci alert indicator does two things. It finds the most recent confirmed swing high and low, then draws the five standard retracement lines between them. When the previous bar comes within `InpTouchPips` of one of those lines, a popup names the level it reached.

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: FiboSwingHigh, FiboSwingLow
Alerts popup
Inputs 10

What the Fibonacci alert Indicator draws on the chart

FiboSwingHigh marks a confirmed swing high with a red arrow just above the bar.

FiboSwingLow marks a confirmed swing low with a lime arrow just below it.

Five OBJ_HLINE objects carry the 23.6%, 38.2%, 50.0%, 61.8% and 78.6% levels.

Each line has its own colour input, from `InpColor236` in dodger blue to `InpColor786` in aqua.

  • FiboSwingHigh: arrow, red, width 2, arrow code 234
  • FiboSwingLow: arrow, lime, width 2, arrow code 233
Fibonacci alert indicator on EURUSD H1 with swing pivot arrows and five retracement levels
Fibonacci alert indicator on EURUSD H1 with swing pivot arrows and five retracement levels

How the Fibonacci alert Indicator calculates its values

Confirming a swing pivot

A bar counts as a swing high when no bar within `InpSwingLookback` on either side prints a higher high. The default of `8` means eight bars left and eight bars right. That lookahead fixes the pivot once those bars close, and it also puts the arrow eight bars behind the current one.

Drawing the retracement lines

range takes swingH minus swingL. Each level then subtracts a share of that range from the swing high: 0.236, 0.382, 0.500, 0.618 and 0.786. `InpMaxSearchBars` at `400` limits how far back the code hunts for the pivot pair defining the grid.

Testing for a touch

The check runs on bar 1, the last completed bar. tol takes `InpTouchPips` times the pip size for the symbol, which defaults to `3.0` pips. The code measures both the high and the low of that bar against every level, then reports the first one inside tolerance. Only one level fires per bar.

How to read the signals

The two arrows show you which swings the current grid came from.

A touch alert names the level, so 61.8% and 38.2% are easy to tell apart.

The grid holds its place until a newer pivot pair replaces it.

Turn `InpDrawLines` off when you want the arrows and alerts without the lines.

Alert channels in this build: popup, one message per closed bar.

`InpEnableAlerts` ships on and drives a terminal popup naming the level that was touched. This build has no push, email or sound channel. The guard permits one message per closed bar, so a bar resting on a level will not repeat itself.

Every Fibonacci alert Indicator input

Core settings

Setting What it does Default
InpSwingLookback bars each side for pivot. Bars each side of a pivot, default `8`. Raise it for larger swings and later arrows. 8
InpMaxSearchBars bars to scan for pivots. How far back to hunt for the pivot pair, default `400`. 400
InpTouchPips proximity (pips) for level touch. Touch tolerance in pips, default `3.0`. Widen it on instruments with larger spreads. 3.0

Display settings

Setting What it does Default
InpDrawLines draw horizontal level lines. Draws the five horizontal levels, default `true`. on
InpColor236 Colour of the 23.6% line, default dodger blue. dodger blue
InpColor382 Colour of the 38.2% line, default orange. orange
InpColor500 Colour of the 50.0% line, default gold. gold
InpColor618 Colour of the 61.8% line, default magenta. magenta
InpColor786 Colour of the 78.6% line, default aqua. aqua

Alert settings

Setting What it does Default
InpEnableAlerts alert on level touch. Popup on a level touch, default `true`. on
Fibonacci alert indicator inputs: InpSwingLookback, InpMaxSearchBars, InpTouchPips
Fibonacci alert indicator inputs: InpSwingLookback, InpMaxSearchBars, InpTouchPips

Settings that fit your chart

Retracement levels need a swing worth measuring. EURUSD H1 is the reference chart, where `InpSwingLookback` at `8` picks out swings lasting most of a session. Down on M1 the pivot test fires on noise. Up on H4 and daily the grid changes rarely, and a touch on the 61.8% line becomes an event rather than a routine.

When the Fibonacci alert Indicator fails

Pivots confirm `InpSwingLookback` bars late, so the grid always describes a swing that has already finished.

A single spike can become the swing high and drag every level along with it.

The touch test reads bar 1 only. Price can cross a level mid-bar and leave no alert behind.

Copy the compiled Fibonacci alert 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 Fibonacci alert Indicator: Fibonacci Retracements at StockCharts ChartSchool, Impossible trinity on Wikipedia.

Download the Fibonacci alert Indicator for MT4 and MT5

The zip holds the compiled Fibonacci alert 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.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

What does InpTouchPips at 3.0 allow?

Three pips of slack either side of a level. tol converts that into price using the pip size for the symbol, then the code compares the high and low of bar 1 against every level. Widen it on instruments with wide spreads, or the alert will keep missing by a fraction.

How far back does InpMaxSearchBars look?

Four hundred bars by default. That is how far the code hunts for the swing pair defining the grid. On EURUSD H1 it covers roughly two and a half weeks. Reduce it when you want the levels to track a more recent swing instead.

Why does the FiboSwingHigh arrow appear late?

Because a pivot needs `InpSwingLookback` bars on both sides. With the default of `8`, the code cannot confirm a swing high until eight newer bars have closed below it. The arrow then sits at the original bar, but you only see it eight bars afterwards.

Can I hide the levels with InpDrawLines?

Yes. Set `InpDrawLines` to false and the five OBJ_HLINE objects stop appearing. Arrows and touch alerts carry on as before, because the code still calculates the levels internally. That suits a chart already crowded with other drawings.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Fibonacci alert 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

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment