SRDC Fibo AHA V0_1b

Author: Copyright ?2006, AHA
SRDC Fibo AHA V0_1b
Price Data Components
Series array that contains open time of each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
0 Views
0 Downloads
0 Favorites
SRDC Fibo AHA V0_1b
//+------------------------------------------------------------------+
//|                                           SRDC Fibo AHA V0_1.mq4 |
//|                                             Copyright ?2006, AHA |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2006, AHA"
#property link      ""

#property indicator_chart_window
extern color dailyfibocolor=Purple;

string fiboobjname="Daily Fibo from SRDC Fibo AHA";
bool startup;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   startup=true;
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
void drawdailyfibo()
{
   if(TimeDay(Time[0])==TimeDay(Time[1])&&!startup) return;
   ObjectDelete(fiboobjname);
   
   datetime aday=iTime(NULL,PERIOD_D1,1);
   int bar=iBarShift(NULL,0,aday);
   double dailyhigh=0.0, dailylow=100000.0;
   int highbar, lowbar, i=bar;
   
   while(TimeDay(iTime(NULL,0,i))==TimeDay(iTime(NULL,0,bar)))
   {
      if(iHigh(NULL,0,i)>dailyhigh)
      {
         dailyhigh=iHigh(NULL,0,i);
         highbar=i;
      }
      if(iLow(NULL,0,i)<dailylow)
      {
         dailylow=iLow(NULL,0,i);
         lowbar=i;
      }
      i--;
   }
   if (highbar>lowbar) 
      ObjectCreate(fiboobjname, OBJ_FIBO, 0, Time[lowbar], dailylow, Time[highbar], dailyhigh);
   else if (highbar<lowbar) 
      ObjectCreate(fiboobjname, OBJ_FIBO, 0, Time[highbar], dailyhigh, Time[lowbar], dailylow);
   else 
   {
      if (Close[highbar]>Open[highbar])
         ObjectCreate(fiboobjname, OBJ_FIBO, 0, Time[highbar], dailyhigh, Time[lowbar], dailylow);
      else if (Close[highbar]>Open[highbar])
         ObjectCreate(fiboobjname, OBJ_FIBO, 0, Time[lowbar], dailylow, Time[highbar], dailyhigh);
   }   
   ObjectSet(fiboobjname, OBJPROP_LEVELCOLOR, dailyfibocolor);
   ObjectSet(fiboobjname, OBJPROP_FIBOLEVELS, 11);
     ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL, 0.0);
   ObjectSetFiboDescription(fiboobjname,0,"0.00     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+1, 0.236);
   ObjectSetFiboDescription(fiboobjname,1,"23.6     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+2, 0.382);
   ObjectSetFiboDescription(fiboobjname,2,"38.2     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+3, 0.50);
   ObjectSetFiboDescription(fiboobjname,3,"50.0     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+4, 0.618);
   ObjectSetFiboDescription(fiboobjname,4,"61.8     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+5, 0.764);
   ObjectSetFiboDescription(fiboobjname,5,"76.4     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+6, 1.000);
   ObjectSetFiboDescription(fiboobjname,6,"100.0     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+7, 1.236);
   ObjectSetFiboDescription(fiboobjname,7,"123.6     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+8, 1.382);
   ObjectSetFiboDescription(fiboobjname,8,"138.2     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+9, 1.50);
      ObjectSetFiboDescription(fiboobjname,9,"15.0     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+10, 1.618);
   ObjectSetFiboDescription(fiboobjname,10,"161.8     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+11, 2.000);
   ObjectSetFiboDescription(fiboobjname,11,"200.0     %$");
   ObjectSet(fiboobjname, OBJPROP_FIRSTLEVEL+12, 2.618);
   ObjectSetFiboDescription(fiboobjname,12,"261.8     %$");
   ObjectsRedraw();
   
   return;
}//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   //int    counted_bars=IndicatorCounted();
//----
   drawdailyfibo();

   startup=false;
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments