Navigation:Home > Content >

XALIF!.mq4

Time: 2015-07-01 | Download file:XALIF!.mq4

//+------------------------------------------------------------------+
//|                                               maloma 4 XALIF.mq4 |
//+------------------------------------------------------------------+
#property copyright "© Maloma"

#property indicator_chart_window

//---- input parameters
extern int    StartHour1st=5;
extern int    EndHour1st=9;
extern int    StartHour2nd=12;
extern int    EndHour2nd=15;
       bool   NewDay=true;
       double UpPrice1st=0;
       double DnPrice1st=0;
       double UpPrice2nd=0;
       double DnPrice2nd=0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicator buffers mapping  
//---- drawing settings
//----
//---- name for DataWindow
//---- initialization done   
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   ObjectDelete("UpLINE1st");  
   ObjectDelete("DnLINE1st");
   ObjectDelete("UpLINE2nd");  
   ObjectDelete("DnLINE2nd");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
void DelOldLines()
{
 if (ObjectFind("UpLINE1st")!=-1)
  {
   ObjectDelete("UpLINE1st");
  }
 if (ObjectFind("DnLINE1st")!=-1)
  {
   ObjectDelete("DnLINE1st");
  }
 if (ObjectFind("UpLINE2nd")!=-1)
  {
   ObjectDelete("UpLINE2nd");
  }
 if (ObjectFind("DnLINE2nd")!=-1)
  {
   ObjectDelete("DnLINE2nd");
  }
 DnPrice1st=0;
 UpPrice1st=0;
 DnPrice2nd=0;
 UpPrice2nd=0;
 return(0);
}

int start()
  {
   if (Hour()==0 && NewDay)
    {
     DelOldLines();
     NewDay=false;
    }
   if (Hour()UpPrice1st) 
      {
       UpPrice1st=Bid;
       ObjectDelete("UpLINE1st");
       ObjectCreate("UpLINE1st",OBJ_HLINE,0,0,UpPrice1st);
       ObjectSet("UpLINE1st",OBJPROP_COLOR,Gold);
       ObjectSet("UpLINE1st",OBJPROP_WIDTH,2);
      }
     if (BidUpPrice2nd) 
      {
       UpPrice2nd=Bid;
       ObjectDelete("UpLINE2nd");
       ObjectCreate("UpLINE2nd",OBJ_HLINE,0,0,UpPrice2nd);
       ObjectSet("UpLINE2nd",OBJPROP_COLOR,Coral);
       ObjectSet("UpLINE2nd",OBJPROP_WIDTH,2);
      }
     if (Bid=EndHour2nd) {NewDay=true;}
  }
//+------------------------------------------------------------------+

Recommend