BenOpenLines





#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 Lime
#property indicator_color3 Lime


//---- input parameters
static int HL_Hours = 24; //4 = 4 hours 
extern int distancefromopen=30;



//---- indicator buffers
double openbuffer[];
double topbuffer[];
double bottombuffer[];



int init()
{
   
   SetIndexBuffer(0, openbuffer);
   SetIndexStyle(0, DRAW_LINE, 0,3);
  
   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID, 2);
   SetIndexArrow(1,233);
   SetIndexBuffer(1,topbuffer);
   SetIndexEmptyValue(1,0.0);
   
   SetIndexStyle(2,DRAW_LINE,STYLE_SOLID, 2);
   SetIndexArrow(2,234);
   SetIndexBuffer(2,bottombuffer);
   SetIndexEmptyValue(2,0.0);
 

   return(0);
}

int deinit()
{
       ObjectsDeleteAll(0,OBJ_LABEL); 

   return(0);
}

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

   if (Period() >= PERIOD_D1) return(0);
   
   for (count=Bars;count>=0;count--) 
   {
      topbuffer[count]=0; bottombuffer[count]=0;
      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;
            O=Open[count];

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

      hour_high = MathMax(hour_high, High[count]);
      hour_low = MathMin(hour_low, Low[count]);
     
      openbuffer[count]=O;
      topbuffer[count]=O+distancefromopen*Point;
      bottombuffer[count]=O-distancefromopen*Point;
      

   }
    

   return(0);
}






Sample





Analysis



Market Information Used:

Series array that contains open time of each bar
Series array that contains open prices 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: