ATM_HiLoXTF





//+------------------------------------------------------------------------+
//| This indicator was originaly called the HiLoH4.mq4 created by Rob Judd                                                         
//| to show the last four hours' Hi and Lo on the chart. THANK YOU ROB !!
//|
//| Accrete hacked the code to ad the Median line and also the ability
//| to change the look back time to include a user variable in the pop up
//| dialog box for breakout trading on 1 hour or more boxes.
//| File can be found at Accrete.com in indicator section with kudos
//| mentioned to Rob for original code. Renamed : ATM_HiLoXTF.mq4 by Accrete
//+------------------------------------------------------------------------+


#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Purple
#property indicator_color3 Red


//---- input parameters
extern int HL_Hours = 2; //24 = 24 hours and 1 would = 1 hour
extern bool show_comment=true;
extern bool show_average=true;

//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

int init()
{
   SetIndexBuffer(0, ExtMapBuffer1);
      SetIndexStyle(0,DRAW_LINE, 2,0);
   SetIndexBuffer(1, ExtMapBuffer2);
   SetIndexStyle(1, DRAW_LINE, 2,0);
   SetIndexBuffer(2, ExtMapBuffer3);
   SetIndexStyle(2, DRAW_LINE, 2,0);
   return(0);
}

int deinit()
{
   return(0);
}

int start()
{
   int count, cur_hour, prev_hour = 0;
   double hour_high, hour_low, H, L, A = 0;

   if (Period() >= PERIOD_D1)
      return(0);
   
   for (count=Bars;count>=0;count--) {

      cur_hour = TimeHour(Time[count]);

      if (prev_hour != cur_hour) {

         prev_hour = cur_hour;


if (!MathMod(cur_hour,HL_Hours)) {
         
            H = hour_high;
            A = (hour_high+hour_low)*0.5;
            L = hour_low;
            

            hour_high = High[count];
            hour_low = Low[count];
         }
      }

      hour_high = MathMax(hour_high, High[count]);
      hour_low = MathMin(hour_low, Low[count]);

      ExtMapBuffer1[count] = H;
      if (show_average)
         ExtMapBuffer2[count] = A;
      ExtMapBuffer3[count] = L;
   }

   if (show_comment)
            Comment("",HL_Hours, " Hour Hi=", H, ", Lo=", L, ", Range=", (H-L)/Point, " pips" );


   return(0);
}






Sample





Analysis



Market Information Used:

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


Indicator Curves created:


Implements a curve of type DRAW_LINE
Implements a curve of type DRAW_LINE

Indicators Used:



Custom Indicators Used:

Order Management characteristics:

Other Features: