General question about MQL

I’m trying to edit a Pivot Point indicator that I’m using to exclude Sunday data. I have the general gist in my head as to how to do it (If TimeDayOfWeek(Blahblah) returns 1, use HLC from 2 days ago). However, I’ve never programmed before and I doubt I’m writing this in the correct manner because it doesn’t seem to do anything at the moment:

   int i, dayi, counted_bars = IndicatorCounted();
//---- check for possible errors
   if(counted_bars < 0) 
       return(-1);
//---- last counted bar will be recounted
   if(counted_bars > 0) 
       counted_bars--;  
   int limit = Bars - counted_bars;
//----   
   for(i = limit - 1; i >= 0; i--)
     {
     if(backtest)
     {
       dayi = iBarShift(Symbol(), myPeriod, Time[i], false);
     }
[B]       if (TimeDayOfWeek(dayi) == 1)
       {
          YesterdaysHigh = iHigh(Symbol(), myPeriod,dayi+2);
          YesterdaysClose = iClose(Symbol(), myPeriod,dayi+2);
          YesterdaysLow = iLow(Symbol(), myPeriod,dayi+2);
       }
       else
       {

          YesterdaysHigh = iHigh(Symbol(), myPeriod,dayi+1);
          YesterdaysClose = iClose(Symbol(), myPeriod,dayi+1);
          YesterdaysLow = iLow(Symbol(), myPeriod,dayi+1);
       }[/B]

The bolded portion is the portion I tried to add. Could someone give me a clue as to what I am doing wrong?

I figured it out, guys. Looks like I needed to use TimeDayofWeek on Time[i].

Have you tried the mql4 forum - probably quicker reponses for code than you’d get on here.