MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Source code library - Expert Advisors, Indicators and Scripts

Check MetaTrader Market in order to find your Expert Advisor
To post a new code, please log in or register

Interesting script?
So post a link to it -
let others appraise it

You liked the script? Try it in the MetaTrader 5 terminal

2011.01.17 18:00
XIT_FIBS.mq4 - Automatically plot Fibonacci retracement lines with price on visible chart.

XIT_FIBS.mq4 - Automatically plot Fibonacci retracement lines with price on visible chart. - indicator for MetaTrader 4

| English Spanish Portuguese

Views:
24455
Rating:
votes: 2
Files:
XIT_FIBS.mq4 (3.7 KB)view

XIT_FIBS.mq4 - Automatically plot Fibonacci retracement lines with price on visible chart.

Just attach indicator to your chart and it will automatically place Fibonacci retracement lines from the highest and lowest visible bars on the chart. Lines are green when Fibonacci trend is up and red when down.

Make sure Auto Scroll is is check on your chart for the indicator to work correctly.


Last comments | Go to discussion (10)
MQL4 Comments
mql4_comments | 26 Feb 2011 at 14:22
Thank you for such a terrific indicator. I mostly use FIBS for exit targets with great success. Thank you.
cisco press
cisco | 20 Jul 2011 at 16:55
cisco press
cisco | 20 Jul 2011 at 17:02

hi

shorter. :)

tnx for code

//+------------------------------------------------------------------+
//|                                                    XIT_FIBS.mq4  |
//|                         Copyright © 2011, Jeff West - Forex-XIT  |
//|                                        http://www.forex-xit.com  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Jeff West - Forex-XIT"
#property link      "http://www.forex-xit.com"
 
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
ObjectDelete("XIT_FIBO");
Comment("");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
ObjectDelete("XIT_FIBO");
Comment("");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  //----
 
     int fibHigh = iHighest(Symbol(),Period(),MODE_HIGH,WindowFirstVisibleBar()-1,1);
     int fibLow  = iLowest(Symbol(),Period(),MODE_LOW,WindowFirstVisibleBar()-1,1);
     
     datetime highTime = Time[fibHigh];
     datetime lowTime  = Time[fibLow];
     
      if(fibHigh>fibLow){
      WindowRedraw();
      ObjectCreate("XIT_FIBO",OBJ_FIBO,0,highTime,High[fibHigh],lowTime,Low[fibLow]);
      color levelColor = Red;
      }
      else{
      WindowRedraw();
      ObjectCreate("XIT_FIBO",OBJ_FIBO,0,lowTime,Low[fibLow],highTime,High[fibHigh]);
      levelColor = Green;
      }
      
      double fiboPrice1=ObjectGet("XIT_FIBO",OBJPROP_PRICE1);
      double fiboPrice2=ObjectGet("XIT_FIBO",OBJPROP_PRICE2);
      
      /*
      double fiboPriceDiff = fiboPrice2-fiboPrice1;
      string fiboValue0 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.0,Digits);
      string fiboValue23 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.236,Digits);
      string fiboValue38 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.382,Digits);
      string fiboValue50 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.50,Digits);
      string fiboValue61 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.618,Digits);
      string fiboValue100 = DoubleToStr(fiboPrice2-fiboPriceDiff*1.0,Digits);
    */
     ObjectSet("XIT_FIBO",OBJPROP_FIBOLEVELS,6);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+0,0.0);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+1,0.236);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+2,0.382);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+3,0.50);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+4,0.618);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+5,1.0);
     
     
     ObjectSet("XIT_FIBO",OBJPROP_LEVELCOLOR,levelColor);
     ObjectSet("XIT_FIBO",OBJPROP_LEVELWIDTH,1);
     ObjectSet("XIT_FIBO",OBJPROP_LEVELSTYLE,STYLE_DASHDOTDOT);
     ObjectSetFiboDescription( "XIT_FIBO", 0,"%$  --> 0.0%"); 
     ObjectSetFiboDescription( "XIT_FIBO", 1,"%$ --> 23.6%"); 
     ObjectSetFiboDescription( "XIT_FIBO", 2,"%$ --> 38.2%"); 
     ObjectSetFiboDescription( "XIT_FIBO", 3,"%$ --> 50.0%");
     ObjectSetFiboDescription( "XIT_FIBO", 4,"%$ --> 61.8%");
     ObjectSetFiboDescription( "XIT_FIBO", 5,"%$ --> 100.0%");
   
   
 
//----
   return(0);
  }
//+------------------------------------------------------------------+ 
moshelevii
moshelevii | 20 Aug 2012 at 20:21
cisco:

hi

shorter. :)

tnx for code

//+------------------------------------------------------------------+
//|                                                    XIT_FIBS.mq4  |
//|                         Copyright © 2011, Jeff West - Forex-XIT  |
//|                                        http://www.forex-xit.com  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, Jeff West - Forex-XIT"
#property link      "http://www.forex-xit.com"
 
#property indicator_chart_window
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
ObjectDelete("XIT_FIBO");
Comment("");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
ObjectDelete("XIT_FIBO");
Comment("");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  //----
 
     int fibHigh = iHighest(Symbol(),Period(),MODE_HIGH,WindowFirstVisibleBar()-1,1);
     int fibLow  = iLowest(Symbol(),Period(),MODE_LOW,WindowFirstVisibleBar()-1,1);
     
     datetime highTime = Time[fibHigh];
     datetime lowTime  = Time[fibLow];
     
      if(fibHigh>fibLow){
      WindowRedraw();
      ObjectCreate("XIT_FIBO",OBJ_FIBO,0,highTime,High[fibHigh],lowTime,Low[fibLow]);
      color levelColor = Red;
      }
      else{
      WindowRedraw();
      ObjectCreate("XIT_FIBO",OBJ_FIBO,0,lowTime,Low[fibLow],highTime,High[fibHigh]);
      levelColor = Green;
      }
      
      double fiboPrice1=ObjectGet("XIT_FIBO",OBJPROP_PRICE1);
      double fiboPrice2=ObjectGet("XIT_FIBO",OBJPROP_PRICE2);
      
      /*
      double fiboPriceDiff = fiboPrice2-fiboPrice1;
      string fiboValue0 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.0,Digits);
      string fiboValue23 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.236,Digits);
      string fiboValue38 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.382,Digits);
      string fiboValue50 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.50,Digits);
      string fiboValue61 = DoubleToStr(fiboPrice2-fiboPriceDiff*0.618,Digits);
      string fiboValue100 = DoubleToStr(fiboPrice2-fiboPriceDiff*1.0,Digits);
    */
     ObjectSet("XIT_FIBO",OBJPROP_FIBOLEVELS,6);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+0,0.0);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+1,0.236);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+2,0.382);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+3,0.50);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+4,0.618);
     ObjectSet("XIT_FIBO",OBJPROP_FIRSTLEVEL+5,1.0);
     
     
     ObjectSet("XIT_FIBO",OBJPROP_LEVELCOLOR,levelColor);
     ObjectSet("XIT_FIBO",OBJPROP_LEVELWIDTH,1);
     ObjectSet("XIT_FIBO",OBJPROP_LEVELSTYLE,STYLE_DASHDOTDOT);
     ObjectSetFiboDescription( "XIT_FIBO", 0,"%$  --> 0.0%"); 
     ObjectSetFiboDescription( "XIT_FIBO", 1,"%$ --> 23.6%"); 
     ObjectSetFiboDescription( "XIT_FIBO", 2,"%$ --> 38.2%"); 
     ObjectSetFiboDescription( "XIT_FIBO", 3,"%$ --> 50.0%");
     ObjectSetFiboDescription( "XIT_FIBO", 4,"%$ --> 61.8%");
     ObjectSetFiboDescription( "XIT_FIBO", 5,"%$ --> 100.0%");
   
   
 
//----
   return(0);
  }
//+------------------------------------------------------------------+ 
Is any one can write EA for that Auto Fib
mikecool
mikecool | 27 Nov 2012 at 14:12

This is a nice and good indicator, i love it. but I will like you to add a trend lines to it, like quick fibo. It will make it more better and more powerful.

See the pics below to see what i mean