Code for High, Low 2 last bar week H4

 
How to find the value of High and Low of the 2 last bars of the previous week in H4 ?

Thanks
 

Here's one way:


int start()
{  
  double high, low;
  for(int i = 0; i < Bars-1; i++){
    if(    TimeDay(        iTime(Symbol(), PERIOD_H4, i))     == TimeDay(TimeCurrent()))  continue;
    if(    TimeDayOfWeek(  iTime(Symbol(), PERIOD_H4, i))     == 5){
       high = MathMax(iHigh(Symbol(), PERIOD_H4, i), iHigh(Symbol(), PERIOD_H4, i+1));
       low  = MathMin(iLow (Symbol(), PERIOD_H4, i), iLow (Symbol(), PERIOD_H4, i+1));
       break;
    }
 }
 Comment(  "High =    "+high+
         "\nLow =     "+low);
 
   return(0);
}
 
OK,thank you.

If i want to introduce code for line indicator Hi and Lo with this, is this complicated?

Thanks
 

?

 
An indicator which traces a line for high and for low (2 last H4 bar week) for each week on a H4 graph.

Thanks

(mecanical traduction)
Reason: