Auto Fibo Retracement

  • Date Added: 2010-10-08
  • Current Version: 2.9
  • Last Updated: 2014-03-18
  • Type: MT4 Indicator


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.


  • FiboColor [DEFAULT: Yellow] the color of the Fibonacci retracement chart object. For information on valid values, please refer to the mql4 documentation on color type and web colors.
  • FiboWidth [DEFAULT: 1]  – the width of the retracement lines. Valid values are 1 to 5 (integer).
  • FiboStyle [DEFAULT: 0 (STYLE_SOLID)] – the style of the retracement lines. Valid values are 0 to 4 (integer) and the numbers correspond to line styles as follows:
    0 STYLE_SOLID The pen is solid
    1 STYLE_DASH The pen is dashed
    2 STYLE_DOT The pen is dotted
    3 STYLE_DASHDOT The pen has alternating dashes and dots
    4 STYLE_DASHDOTDOT The pen has alternating dashes and double dots
  • FiboLevels [DEFAULT: "0.0, 0.236, 0.382, 0.50, 0.618, 0.786, 1.0"] – 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 [DEFAULT: 0] – sets the 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). This parameter is affected significantly by BarShift (see next parameter). Valid values are 0 and positive integers.
  • BarShift [DEFAULT: 0] – sets the 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.
    Valid values are 0 and positive integers.
  • WaitForCloseToUpdate [DEFAULT: false] – this parameter is 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. Valid values are true/false.
  • ShowRetracedZone [DEFAULT: true] – this parameter tells the indicator whether or not to draw a rectangle in the retracement zone. This zone is drawn from 0.0 to the furthest retraced price. Valid values are true/false.
  • RetracedZoneColor [DEFAULT: Green] – the color of the retracement zone rectangle (if shown). For information on valid values, please refer to the mql4 documentation on color type and web colors.
  • ShowUnretracedZone [DEFAULT: true] – this parameter tells the indicator whether or not to draw a rectangle in the unretraced zone. This zone is drawn from  the furthest retraced price (edge of retracement zone) to 1.0 (100%). Valid values are true/false.
  • UnretracedZoneColor [DEFAULT: Red] – the color of the unretraced zone rectangle (if shown). For information on valid values, please refer to the mql4 documentation on color type and web colors.
  • SpanMode [DEFAULT: 0] – this parameter is only used if one of the above two Show*Zone parameters is set to true. It tells the indicator how to draw the zone rectangle(s) in terms of width. Valid values are 0 to 2 (integer) and correspond to the span as follows:0 – Spans only the zone where the retracement occurred
    1 – Spans the zone (encompasses 0) plus expands up to the shift bar (as defined by BarShift)
    2 – Spans from the shift bar (as defined by BarShift) to the end of the retracement
  • FiboObjPrefix [DEFAULT: "AutoFibo_"] – the prefix for all chart object name 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. Please note that each indicator instance will derive another prefix from this by appending an id for that instance (e.g. AutoFibo_872874_0).

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.

When using the default parameter for LookbackBars, the retracement will update (on next tick) if you zoom in/out because it is based on the visible bars on the chart (this number changes on zoom). If this parameter is changed from 0, then the bars in the calculation will be fixed and zoom in/out will not affect the retracement.

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.


  1. Find your MetaTrader 4 data folder. Open MT4->File>Open Data Folder;
  2. Navigate to the MQL4 directory, then the Indicators directory;
  3. Note the path or leave open;
  4. Download the ex4 by clicking the "Download Current Version" button at the top of the page;
  5. Save or drag (if left directory open) the ex4 file to MetaTrader 4's data to the directory noted in step 3;
  6. Restart MT4 if it is open;
  7. The indicator should now appear under Custom Indicators in the Navigator window.

License Info

Auto Fibo Retracement is free software. You may redistribute it and/or modify it under the terms of our modified MIT License.

Please see our Modified MIT License for more details

If you place a link back to this page, please try to use the following html:
<a href="">Auto Fibo Retracement</a>

Please report any bugs/problems or suggestionshere

Subscribe here to be notified when this or other products are updated.

Be sure to check out the MT4 tips and tricks page for ways to enhance the use of our tools.

--Page Last Updated: September 25, 2014--


Subscribe to our newsletter for important product updates and new product releases!

Contact Us