PeriodSeperator_edited_by_tc_v1.1mm





//+------------------------------------------------------------------+
//|                                             Period Seperator.mq4 |
//|                                              lucidlamp@gmail.com |
//+------------------------------------------------------------------+
//mod.trendchaser FF

#property link      "lucidlamp@gmail.com"

#property indicator_chart_window
extern int tf=60;
extern int start_minute=0;
extern int interval=15;
int interval2=0;

extern color   LineColor = DarkOliveGreen; 
extern int     LineStyle = 2;
extern int     LineWidth = 1;

extern bool    ObjOnBckgrnd = true;
extern int     xObjScreens = 1;

extern string inputs="15 30 60 240(H4) 1440D 10080W 43200MN";
extern string inputs2="one year is 518400";
extern string inputs3="set tf to 0 to use interval";
extern string inputs4="interval only works under 60 minutes";
 int iMinute1=00; // I use 12 as it corresponds with 8am EST, when the metals get active.
 int iMinute2=00;
 int iMinute3=00;
 int iMinute4=00;

 int iSecond=00;

int x=0;


 double       minutes  = 0;
 string name;


int init()
   {
   interval2=start_minute;
   }
   
int deinit()
   {
      for(int z=1;z<=x;z++)
         {
            ObjectDelete(name + z);
         }
   }
   
int start()
	{
      int iIndicatorCounted=IndicatorCounted();
      if(iIndicatorCounted<0)
         {
            return(-1);
         }

      int iLimit=Bars-iIndicatorCounted;
      
      name = "Time" +tf +interval;

      
      for(int i=iLimit;i>=0;i--)
         {
        if(i > WindowBarsPerChart()+1*xObjScreens) continue;

            if(tf==15&&TimeMinute(Time[i])==0)
               {
                  x++;
                  
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
               }
         
         if(tf==15&&TimeMinute(Time[i])==15)
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
               }
         
         if(tf==15&&TimeMinute(Time[i])==30)
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
               }
         
         if(tf==15&&TimeMinute(Time[i])==45)
               {
                 x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
}        


if(tf==30&&TimeMinute(Time[i])==0)
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
               }
         
         if(tf==30&&TimeMinute(Time[i])==30)
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)      
  }
  if(tf==60&&TimeMinute(Time[i])==iMinute1 && TimeSeconds(Time[i])==iSecond)
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
               }
         
  
  if(tf==240&&TimeMinute(Time[i])==0&&TimeHour(Time[i])==0)
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
               }
         
         if(tf==240&&TimeMinute(Time[i])==0&&TimeHour(Time[i])==4)
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
               }
         
         if(tf==240&&TimeMinute(Time[i])==0&&TimeHour(Time[i])==8)
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
               }
         
         if(tf==240&&TimeMinute(Time[i])==0&&TimeHour(Time[i])==12)
               {
                 x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
       }
           if(tf==240&&TimeMinute(Time[i])==0&&TimeHour(Time[i])==16)
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
               }
         
         if(tf==240&&TimeMinute(Time[i])==0&&TimeHour(Time[i])==20)
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
}
 if(tf==1440&&TimeHour(Time[i])==0&&TimeMinute(Time[i])==0  )
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
   } 
    if(tf==10080&&TimeDayOfWeek(Time[i])==1&&TimeMinute(Time[i])==0 &&TimeHour(Time[i])==0 )
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
        
        }
         if(tf==43200&&TimeDay(Time[i])==1&&TimeMinute(Time[i])==0 &&TimeHour(Time[i])==0 )
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
                  
                  }
                   if(tf==518400&&TimeMonth(Time[i])==1&&TimeDayOfYear(Time[i])<=10 )
               {
                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+tf*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
   }
 
     if(tf==0&&TimeMinute(Time[i])==interval2 )
               {
interval2=interval2+interval;

                  x++;
                  ObjectCreate(name + x,OBJ_VLINE,0,Time[i]+interval2*60,High[i]);
                  ObjectSet(name + x,OBJPROP_COLOR,LineColor); // Color value to set/get object color.
                  ObjectSet(name + x,OBJPROP_STYLE,LineStyle); // Value is one of STYLE_SOLID, STYLE_DASH, STYLE_DOT, STYLE_DASHDOT, STYLE_DASHDOTDOT constants to set/get object line style.
                  ObjectSet(name + x,OBJPROP_WIDTH,LineWidth); // Integer value to set/get object line width. Can be from 1 to 5.
                  ObjectSet(name + x,OBJPROP_BACK,ObjOnBckgrnd); // Boolean value to set/get background drawing flag for object. (for example "true" will hide the value at the bottom of the chart.)
     }
     if(tf==0&&interval2>59 ){interval2=start_minute;

         
                                                    
}       
}
}



Sample





Analysis



Market Information Used:

Series array that contains open time of each bar
Series array that contains the highest prices of each bar


Indicator Curves created:


Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: