Auto Fibo Retracement

This MetaTrader 4 indicator automatically draws a Fibonacci retracement on your chart given a set of parameters. The indicator can also be set to highlight the retraced and un-retraced area on the chart.


Product Description

The Auto Fibo Retracement indicator draws a Fibonacci retracement and optionally, the retraced and/or unretraced zone automatically on your chart. The retracement and un/retraced zones can update automatically during a live candle (default setting) or they can wait for the candle close. The retracement and corresponding zones will update automatically when you switch time frames and even symbols.

The default parameters work great, but are limited to the visible bars on the chart (which may be too many or too little). Make sure to experiment with your own parameters. In a nutshell, the calculation parameters can be tweaked to give you a retracement for any area on the chart. You could even isolate the current bar if you wanted to (maybe handy for a scalper)!

Why stop at one? You can add more instances with different parameter sets for multiple retracements.



  • FiboLevels: the retracement levels to be calculated in the chart object. This parameter must be entered as a string with the retracement levels in decimal form and separated by commas. Levels greater than 1.0 (or 100%) are OK. However, negative retracement levels won’t work on live fibo retracements because a breach of this level will trigger the object to be redrawn.
  • LookbackBars: optional number of bars to be used in the calculation of the retracement levels. If the parameter is left at 0, the indicator will use the visible bars in the calculation (in a sense, this parameter is disregarded if set to 0) and will update on chart zoom in/out.  This parameter is affected significantly by BarShift.
  • BarShift: optional bar shift to start the calculation. The first bar on the chart is 0. So for example, if BarShift is set to 2, the fibo calculation starts 2 bars back. If this is set to 0, the fibo will update during the live candle (unless WaitForCloseToUpdate is set to true, in which case, BarShift should really be set to 1 or higher).
    An example including LookbackBars is if LookbackBars is set to 100 and BarShift is set to 5. The indicator will begin looking for high/low values 5 bars back (BarShift) and continue looking for another 100 bars (LookbackBars). In other words, the bars in calculation are 5 to 105 (remember that most recent bars have a lower number starting from the current bar which has an index of 0) . Finally, the high, low, and trend of bar 5 to 105 are used to calculate and draw the Fibonacci retracement. It’s also worth noting that if BarShift is set to 0, the number of visible bars on the chart will replace it.
  • WaitForCloseToUpdate: only used if BarShift is set to 0 and tells the indicator whether to update the retracement and corresponding retraced/unretraced zones during a live candle or wait for the candle to close.
  • ShowRetracedZone: if true, a rectangle is drawn in the retracement zone. This zone is drawn from 0.0 to the furthest retraced price.
  • RetracedZoneColor: the color of the retracement zone rectangle (if shown).
  • ShowUnretracedZone: if true, a rectangle is drawn in the unretraced zone. This zone is drawn from  the furthest retraced price (edge of retracement zone) to 1.0 (100%).
  • UnretracedZoneColor: the color of the unretraced zone rectangle (if shown).
  • FiboObjPrefix: thenaming  prefix for all chart objects created by the indicator. Most people don’t need to change this. This can be used by other indicators, expert advisors, or scripts to find objects created by this indicator.

Feel free to tweak the above parameters as you see fit. However, the indicator should work fine with the default settings and can be simply added to charts after installation. It is perfectly OK to edit the inputs after applying the indicator to a chart from right click->Indicators List (or CTRL + I).

If you are isolating a single bar or two for retracement, the zone rectangle(s) may not draw properly.

You can also automatically generate more than one retracement by adding more instances of the indicator to the chart. Please note that this only makes sense if each instance has different parameters. Otherwise, there will be redundant chart objects using up resources with no additional utility.

Each instance tracks its own objects and only those objects will be removed when it is removed from a chart.