Fibonacci Trend Indicator: A Fibonacci-Weighted Average

Written by Dominic Walsh · Published · Last updated

The fibonacci trend indicator uses the sequence as weights rather than as levels. A `FibLength` bar window is weighted by Fibonacci numbers, so the newest bars carry far more of the result than the oldest. The line then colours by slope, and a crossing of price and line prints a mark.

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 4: FibMA Up, FibMA Down, Buy, Sell
Alerts popup, push notification, email, sound
Inputs 9

What the Fibonacci trend Indicator draws on the chart

FibMA Up is the lime green line, drawn while the average is rising.

FibMA Down is the crimson line for a falling average.

Buy places a lime arrow where the close crossed above the line.

Sell places a red arrow for the crossing back down.

  • FibMA Up: line, lime green, width 2
  • FibMA Down: line, crimson, width 2
  • Buy: arrow, lime, width 2, arrow code 233
  • Sell: arrow, red, width 2, arrow code 234
Fibonacci trend indicator on EURUSD H1 with the weighted line and crossing marks
Fibonacci trend indicator on EURUSD H1 with the weighted line and crossing marks

How the Fibonacci trend Indicator calculates its values

Weighting the window

The code precomputes a weight per position from the Fibonacci sequence. sum then adds weight times price across `FibLength` `21` bars, and divides by the total weight. Because the sequence grows quickly, the last few bars dominate the answer.

Picking the price source

`AppliedPrice` chooses what gets weighted, defaulting to PRICE_CLOSE. Switching it to a median or typical price folds the highs and lows in as well, which steadies the line slightly on a wicky instrument.

Colouring and marking

upSlope compares the current average with the previous one and picks which buffer takes the value. The mark needs the previous close on one side of the line and the current close on the other. offset takes `ArrowOffsetPips` `1.0` times the pip size.

How to read the signals

Colour reports the slope, so it can flip a bar before price crosses.

The heavy weighting means the line tracks price closely for its length.

A crossing in a flat stretch usually reverses within a few bars.

Lengthen `FibLength` when the line hugs price too tightly to be useful.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

`EnableAlerts` ships on and `EnablePopup` delivers the text. `EnablePushNotify`, `EnableEmail` and `EnableSound` all start false. `SoundFile` picks the clip. The crossing test reads completed closes, and the guard allows one trend-flip message per bar.

Every Fibonacci trend Indicator input

Core settings

Setting What it does Default
FibLength Fibonacci weighted MA period. Bars in the weighted window, default `21`. 21
AppliedPrice Applied price. Price the weights are applied to, default PRICE_CLOSE. PRICE_CLOSE

Display settings

Setting What it does Default
ArrowOffsetPips Arrow offset (pips). Mark distance from the bar in pips, default `1.0`. 1.0

Alert settings

Setting What it does Default
EnableAlerts Master switch over the trend-flip alerts, default `true`. on
EnablePopup Terminal dialog on a trend flip, default `true`. on
EnablePushNotify Mobile push on a trend flip, default `false`. off
EnableEmail Mail delivery on a trend flip, default `false`. off
EnableSound Sound playback on a trend flip, default `false`. off
SoundFile Wav file the trend-flip alert plays, default `alert.wav`. alert.wav
Fibonacci trend indicator inputs: FibLength, AppliedPrice, ArrowOffsetPips
Fibonacci trend indicator inputs: FibLength, AppliedPrice, ArrowOffsetPips

Settings that fit your chart

A heavily weighted average reacts fast, which suits shorter holding periods. EURUSD H1 is the reference chart, where `FibLength` at `21` covers about a day. On M5 the line follows price so closely that crossings come in bursts. On H4 the same length covers three days and behaves far more calmly.

When the Fibonacci trend Indicator fails

Fibonacci weighting is a choice, not a discovery. A linear weighting behaves much the same.

The line sits close to price by design, so crossings are frequent.

Colour and crossing can disagree, which looks like a contradiction until you know why.

Copy the compiled Fibonacci trend 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 trend Indicator: Monetary hegemony on Wikipedia, High Low Index at StockCharts ChartSchool.

Download the Fibonacci trend Indicator for MT4 and MT5

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

How does FibLength weight the 21 bars?

By the Fibonacci sequence, one weight per position in the window. Those numbers grow quickly, so the newest handful of bars carries most of the result and the oldest bars barely register. That is what makes the line react faster than a plain average of the same length.

Why does the FibMA Up plot change colour?

Because two buffers share one value. The code compares the current average with the previous one, and a rising reading goes into the lime green buffer while a falling one goes into the crimson. Only one shows at a time.

What does AppliedPrice do to the line?

It picks the series the weights act on. PRICE_CLOSE is the default and ignores wicks. A median or typical setting brings highs and lows in, which smooths the line a little on an instrument with long tails and shifts crossings by a bar or so.

Is ArrowOffsetPips at 1.0 enough on H1?

It is a small gap, chosen so the mark sits tight against the candle. On EURUSD H1 one pip is usually visible. On gold or an index, raise it, because a single pip there disappears behind the bar completely.

Are results guaranteed?

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