The auto fibonacci indicator finds the highest high and lowest low over a rolling window. It plots eight levels between them. FibLookback sets the window length. Every level redraws fresh on each new bar, with no tool to drag by hand.
This build ships as auto-fibo-indicator-forexmt4systems.ex4 for MT4 and auto-fibo-indicator-forexmt4systems.ex5 for MT5; the screenshots below come from EURUSD H1.
| Platforms | MT4 (.ex4) + MT5 (.ex5) |
|---|---|
| Chart window | Main price chart |
| Plots | 8: 0.0%, 23.6%, 38.2%, 50.0%, 61.8%, 100.0%, 161.8%, 261.8% |
| Alerts | popup, push notification, email, sound |
| Inputs | 7 |
What the Auto Fibonacci Indicator draws on the chart
A line labeled 0.0% (goldenrod, DRAW_LINE) sits at the window’s low point.
Four lines, 23.6%, 38.2%, 50.0% and 61.8% (goldenrod, DRAW_LINE), plot the standard retracement fractions between the low and the high.
A line labeled 100.0% (goldenrod, DRAW_LINE) sits at the window’s high point.
Two more lines, 161.8% and 261.8% (goldenrod, DRAW_LINE), extend past the high as extension levels.
- 0.0%: line, goldenrod, width 2
- 23.6%: line, goldenrod, width 1
- 38.2%: line, goldenrod, width 1
- 50.0%: line, goldenrod, width 1
- 61.8%: line, goldenrod, width 1
- 100.0%: line, goldenrod, width 2
- 161.8%: line, goldenrod, width 1
- 261.8%: line, goldenrod, width 1

How the Auto Fibonacci Indicator calculates its values
Finding the window’s high and low
FibLookback, 100 by default, sets how many recent bars the code scans for the window’s top and bottom price. On a short history the window shrinks to fit what bars are available.
The code takes the range between those two prices. Each of the eight levels then sits at the low point plus a fixed fraction of that range.
Placing and clearing the levels
Eight lines, one per level, hold the low plus its own fraction of the range. The fractions run 0.0, 0.236, 0.382, 0.5, 0.618, 1.0, 1.618 and 2.618. Every bar inside the current window carries the same eight values.
Bars older than the window reset to blank on every new bar. Old level segments do not linger once the rolling window has moved past them.
Warm-up and updates
The code needs FibLookback plus a few extra bars of chart history before the first window can compute. Below that floor no line draws at all.
Once that floor is met, every new bar rescans the full FibLookback window fresh. It never carries a partial value forward from the last bar.
How to read the signals
The 0.0% and 100.0% lines mark the low and high of the last FibLookback bars. Every other line sits at a fixed part of that gap.
50.0% and 61.8% sit inside that range and often get watched as retracement points. The 161.8% and 261.8% lines run past 100.0% as extension references.
The window resets on every new bar. All eight lines can shift together when a fresh high or low enters the FibLookback window.
None of the eight lines move on their own between bars. Each one only jumps when the window itself shifts.
Alert channels in this build: popup, push notification, email and sound.
EnableAlerts, EnablePopup, EnablePushNotify, EnableEmail and EnableSound sit in the inputs panel. The level-drawing loop never calls the alert function. None of the four channels fires when the eight goldenrod lines redraw.
Every Auto Fibonacci Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
FibLookback |
FibLookback sets how many recent bars the high-low window covers. It defaults to 100 bars. | 100 |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
(see inputs panel) | on |
EnablePopup |
(see inputs panel) | on |
EnablePushNotify |
(see inputs panel) | off |
EnableEmail |
(see inputs panel) | off |
EnableSound |
(see inputs panel) | off |
SoundFile |
(see inputs panel) | alert.wav |

Settings that fit your chart
The screenshot uses EURUSD H1, picked as a safe chart for a clean shot of the eight goldenrod lines together. A 100-bar window on H1 covers a little over four days of price. The same setup works on other pairs and timeframes, since it only needs a top price and a bottom price. A choppier pair tends to reset the window more often than a calm one.
When the Auto Fibonacci Indicator fails
In a strong trend the rolling window keeps finding a new extreme. All eight levels can shift from one bar to the next instead of holding steady as a fixed reference.
The window only looks at the highest high and lowest low. It has no check for whether those extremes mark a real swing or just a spike. One outlier bar can set the whole window.
There is no alert tied to price touching any level. Reading them relies entirely on watching the chart, not on a notification.
Only one input controls the whole window. There is no separate setting for how far the extension lines should reach.
Copy auto-fibo-indicator-forexmt4systems.ex4 into MQL4/Indicators and auto-fibo-indicator-forexmt4systems.ex5 into MQL5/Indicators, then restart the terminal and drag the Auto Fibonacci Indicator 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 Auto Fibonacci Indicator: Fibonacci Retracements at StockCharts ChartSchool, KST oscillator on Wikipedia.
Download the Auto Fibonacci Indicator for MT4 and MT5
The zip auto-fibo-indicator-forexmt4systems.zip holds auto-fibo-indicator-forexmt4systems.ex4, auto-fibo-indicator-forexmt4systems.ex5 and a short README, compiled files only. 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
Where does FibLookback place the auto fibonacci indicator’s anchor lines?
FibLookback, 100 by default, sets the number of recent bars the code scans for a high and a low price. The lowest low in that window becomes the low anchor line. The highest high becomes the high anchor line. Every other level sits at a fixed fraction of the gap between them.
Why do 161.8% and 261.8% sit above the 100.0% line?
161.8% and 261.8% are extension levels, not retracement levels. Both use the same math as the other six lines, but their fractions run past 1.0. That places them above the window’s high rather than between the high and the low. No other line on the chart sits further out.
Does the auto fibonacci indicator send an alert when price touches a level?
No. EnableAlerts and the four channel toggles exist in the inputs panel. The recalculation loop that sets the eight lines never calls the alert function. Reading the goldenrod levels against price stays entirely visual on this build. Nothing pings or pops up on a touch.
What happens to old level segments as FibLookback slides forward?
Every new bar resets bars older than the current FibLookback window back to blank, across all eight lines. That stops a stale copy of the retracement and extension lines from lingering once a bar ages out of the rolling window. Each bar only shows the current window’s values.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Auto Fibonacci Indicator as one input. Always backtest before trading live.
Category: this is part of our Oscillators collection. Also, still, hence, plainly, truly, browse more Oscillators for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.
External references
- For background on this concept, see Fibonacci Retracements at StockCharts ChartSchool.
- For broader market context, see KST oscillator on Wikipedia.
