Navigation:Home > Content >

time2.mq4

Time: 2010-05-09 | Download file:time2.mq4

//+------------------------------------------------------------------+
//|                                                        time1.mq4 |
//|                      Copyright © 2005, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
string t;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
int i,a,b,c,d,e;
     i=Bars-1;                                              //Проверяем весь график
     while(i>0)
      {
      t=DoubleToStr(i,0);
      if(TimeMinute(Time[i])>=0&&TimeHour(Time[i])==8&&a==0)//Время 8:00
         {
         ObjectCreate(t, OBJ_VLINE, 0, Time[i],0);          //Рисуем вертикаль
         ObjectSet(t, OBJPROP_COLOR,MediumBlue);
         a=1;                                               //Флажок, чтобы рисовалась только одна линия
         }
      if(TimeMinute(Time[i])>=0&&TimeHour(Time[i])==11&&b==0)//Время 11:00
         {
         ObjectCreate(t, OBJ_VLINE, 0, Time[i],0);
         ObjectSet(t, OBJPROP_COLOR,Blue);
         b=1;
         }
      if(TimeMinute(Time[i])>=30&&TimeHour(Time[i])==12&&c==0)//Время 12:30
         {
         ObjectCreate(t, OBJ_VLINE, 0, Time[i], 0);
         ObjectSet(t, OBJPROP_COLOR,Purple);
         c=1;
         }
      if(TimeMinute(Time[i])>=0&&TimeHour(Time[i])==14&&d==0)//Время 14:00
         {
         ObjectCreate(t, OBJ_VLINE, 0, Time[i],0);
         ObjectSet(t, OBJPROP_COLOR,Orange);
         d=1;
         }
      if(TimeMinute(Time[i])>=0&&TimeHour(Time[i])==17&&e==0)//Время 17:00
         {
         ObjectCreate(t, OBJ_VLINE, 0, Time[i],0);
         ObjectSet(t, OBJPROP_COLOR,Brown);
         e=1;
         }
      if(TimeHour(Time[i])==00&&TimeMinute(Time[i])>=0&&TimeMinute(Time[i])<=10)//Время 00:00
         {
         a=0;b=0;c=0;d=0;e=0;                               //Сбрасываем все флажки
         }  
      i--;
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//---- 
      t=TimeToStr(CurTime());
      if(TimeMinute(CurTime())==0&&TimeHour(CurTime())==8)
         {
         ObjectCreate(t, OBJ_VLINE, 0, CurTime(),0);
         ObjectSet(t, OBJPROP_COLOR,MediumBlue);
         }
      if(TimeMinute(CurTime())==0&&TimeHour(CurTime())==11)
         {
         ObjectCreate(t, OBJ_VLINE, 0,CurTime(),0);
         ObjectSet(t, OBJPROP_COLOR,Blue);
         }
      if(TimeMinute(CurTime())==30&&TimeHour(CurTime())==12)
         {
         ObjectCreate(t, OBJ_VLINE, 0,CurTime(), 0);
         ObjectSet(t, OBJPROP_COLOR,Purple);
         }
      if(TimeMinute(CurTime())==0&&TimeHour(CurTime())==14)
         {
         ObjectCreate(t, OBJ_VLINE, 0,CurTime(),0);
         ObjectSet(t, OBJPROP_COLOR,Orange);
         }
      if(TimeMinute(CurTime())==0&&TimeHour(CurTime())==17)
         {
         ObjectCreate(t, OBJ_VLINE, 0,CurTime(),0);
         ObjectSet(t, OBJPROP_COLOR,Brown);
         }
   
//----
   return(0);
  }
//+------------------------------------------------------------------+

Recommend