Auto Fibonacci Retracement Indicator: 100-Bar Grid

Written by Dominic Walsh · Published · Last updated

The auto fibonacci retracement indicator does one job and does it without a mouse. It scans the last `FibLookback` bars for the highest high and the lowest low, then paints six horizontal lines across that range. Every line moves on its own as the window rolls forward.

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 6: 0.0%, 23.6%, 38.2%, 50.0%, 61.8%, 100.0%
Alerts popup, push notification, email, sound
Inputs 7

What the Auto Fibonacci Retracement Indicator draws on the chart

Six dodger blue lines carry the labels 0.0%, 23.6%, 38.2%, 50.0%, 61.8% and 100.0%.

0.0% sits on the lowest low of the window and 100.0% sits on the highest high.

The four middle lines split that range at the classic ratios.

Older bars outside the window hold EMPTY_VALUE, so the grid simply stops rather than stretching back forever.

  • 0.0%: line, dodger blue, width 2
  • 23.6%: line, dodger blue, width 1
  • 38.2%: line, dodger blue, width 1
  • 50.0%: line, dodger blue, width 1
  • 61.8%: line, dodger blue, width 1
  • 100.0%: line, dodger blue, width 2
Auto fibonacci retracement indicator on EURUSD H1 with six levels across the 100-bar range
Auto fibonacci retracement indicator on EURUSD H1 with six levels across the 100-bar range

How the Auto Fibonacci Retracement Indicator calculates its values

Finding the window extremes

iHighest and iLowest scan `FibLookback` bars, which defaults to `100`. The code clamps that window to the bars actually on the chart, so a short history cannot break it. top takes the high at the highest index and bot takes the low at the lowest index. rng is simply top minus bot.

Placing the six levels

Each buffer takes bot plus a ratio times rng. L1 uses 0.236, L2 uses 0.382, L3 uses 0.5 and L4 uses 0.618. L0 and L5 pin the two ends of the range. Because every level counts up from the low, the grid reads bottom to top.

Rolling the window forward

A fresh high or low inside the window changes rng, and all six lines shift together. Expect that to happen whenever the swing defining the grid ages out of the last hundred bars. Nothing here anchors to a manual drawing, which is the whole point of the tool.

How to read the signals

Treat 50.0% as the midpoint of the last `FibLookback` bars, nothing more.

Price stalling at 61.8% is stalling in the upper third of the recent range.

When the whole grid jumps, the window has found a fresh extreme.

The spacing between lines tells you how wide the recent range has been.

Alert channels in this build: popup, push notification, email and sound.

`EnableAlerts` ships on with `EnablePopup` carrying the message. `EnablePushNotify`, `EnableEmail` and `EnableSound` are all off by default, and `SoundFile` names the clip. This build has no once-per-bar guard, so keep the noisier channels off unless repeats suit you.

Every Auto Fibonacci Retracement Indicator input

Core settings

Setting What it does Default
FibLookback Bars in the scan window, default `100`. On H1 that covers about four trading days. Shorten it for intraday structure and lengthen it for the wider swing. 100

Alert settings

Setting What it does Default
EnableAlerts Turns the alert block on, default `true`. on
EnablePopup Terminal popup, default `true`. on
EnablePushNotify Mobile push, default `false`. off
EnableEmail Mail delivery, default `false`. off
EnableSound Sound playback, default `false`. off
SoundFile Clip played when sound is on, default `alert.wav`. alert.wav
Auto fibonacci retracement indicator inputs: FibLookback and the alert switches
Auto fibonacci retracement indicator inputs: FibLookback and the alert switches

Settings that fit your chart

A retracement grid suits any instrument with a clear recent swing. EURUSD H1 is the reference chart, where `FibLookback` at `100` spans roughly four days. Drop to M5 and the window covers a single session, so the lines redraw often. On the daily chart the same setting describes months of structure and changes rarely.

When the Auto Fibonacci Retracement Indicator fails

The window cannot tell whether the extreme it found was a real swing or a news spike.

Levels move whenever a new high or low enters the window, so the 61.8% line of yesterday is not the one you see today.

A market grinding sideways gives a narrow range, and six lines packed together tell you very little.

Copy the compiled Auto Fibonacci Retracement 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.

Download the Auto Fibonacci Retracement Indicator for MT4 and MT5

The zip holds the compiled Auto Fibonacci Retracement 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 FibLookback at 100 actually scan?

The last hundred bars on the current chart. iHighest finds the top of that stretch and iLowest finds the bottom. All six levels then sit between those two prices. On EURUSD H1 a hundred bars is roughly four trading days, so the grid describes this week rather than this year.

Why does the 0.0% line sit at the bottom?

Because the code counts up from the low. bot takes the lowest low in the window, and each buffer adds a share of the range to it. So 0.0% marks the low, 100.0% marks the high, and 61.8% sits nearer the top than the middle.

Do the 38.2% and 61.8% lines ever move?

Yes, and often. The window rolls forward one bar at a time. As soon as a fresh extreme enters it or the old one drops out, rng changes and all six lines shift together. Widen `FibLookback` when you want a steadier grid.

Does the 100-bar grid need EURUSD H1?

No. It reads highs and lows only, so any symbol and any timeframe will do. EURUSD H1 is simply the reference chart used for the screenshots. On very thin instruments a single spike can define the entire range, which is worth checking before you trust the levels.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Auto Fibonacci Retracement Indicator as one input. Always backtest before trading live.

Category: this is part of our Oscillators collection. Thus, truly, 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