Finding two low and two high (HH,LH,LL,HL)

 

Hey friends,


im trying to find two level of Higher Low and Lower Low in a specified time frame and also two level of Lower High and Higher High



i tried to find it by this following code but it seems not working and it just specifies Lower Low and Higher High,


Does anyone have an algorithm to do that in simple way and without indicators ( i mean i want to use raw data as like as High[] and Low[] )


void DoLows()
  {
   for(int i=0; i<=len; i++)
     {
      int bigBarIndexOfLow=LocalExtremeBar(i,0,-1);

      double lowValue=Low[bigBarIndexOfLow];

      ObjectDelete("lowLine"+i);
      ObjectCreate("lowLine"+i,OBJ_HLINE,0,Time[0],lowValue);
      ObjectSetInteger(0,"lowLine"+i,OBJPROP_COLOR,clrAqua);
     }
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void DoHighs()
  {
   for(int j=len; j>=0; j--)
     {
      int bigBarIndexOfHigh=LocalExtremeBar(j,len,+1);
      double highValue=High[bigBarIndexOfHigh];
      ObjectDelete("highLine"+j);
      ObjectCreate("highLine"+j,OBJ_HLINE,0,Time[0],highValue);
      ObjectSetInteger(0,"highLine"+j,OBJPROP_COLOR,clrYellow);
     }
  }


Thanks a lot

Reason: