how to change code so i get the highest "close" not the highest high. thanks

 
code for yesterdays high and low:
how do i change it so it gives me yesterday highest "close" not the highest price. and the same for the low. i want the lowest "close" not the lowest price.

//+------------------------------------------------------------------+
//|                                         PrevDaysHighLow_TEST.mq4 |
//+------------------------------------------------------------------+
#property copyright "15.01.2018, Daniel"
#property link      "http://www.mql4.com"
#property version "1.0"
#property  description "Draws the low/high of the previous day."
#property  indicator_buffers 8 //used for drawing
#property indicator_chart_window

#property  indicator_color1  Red
#property  indicator_color2  Red
#property  indicator_width1  2 
#property  indicator_width2  2


#property strict
//+------------------------------------------------------------------+
enum EnumDrawPrevDayHL
  {
   today,//show only today
   previousday,//show with pevious day
   off//none
  };

extern EnumDrawPrevDayHL ShowPrevDayHL=previousday;//Show high and low of the previous day?

//--- indicator buffers
double buff_prevdayhigh[];
double buff_prevdaylow[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetIndexBuffer(0,buff_prevdayhigh);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexEmptyValue(0,0.0);
   SetIndexLabel(0,"previous days high");

   SetIndexBuffer(1,buff_prevdaylow);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexEmptyValue(1,0.0);
   SetIndexLabel(1,"previous days low");

//----
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate (const int rates_total,      // size of input time series
                 const int prev_calculated,  // bars handled in previous call
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int &spread[]) // Spread

  {
   static datetime timeD1=iTime(_Symbol,PERIOD_D1,0);
   // Input is set to off or timeframe is higher than H1 ==> do nothing
   if(ShowPrevDayHL==off || _Period>PERIOD_H1) return(rates_total);
   // Initialize arrays
   if(prev_calculated<1)
     {
      ArrayInitialize(buff_prevdayhigh,0.0);
      ArrayInitialize(buff_prevdaylow,0.0);
     }
   int startShift,endShift;
   // A new day
   if(timeD1<iTime(_Symbol,PERIOD_D1,0))
     {
      // Delete history
      startShift=iBarShift(_Symbol,_Period,iTime(_Symbol,PERIOD_D1,ShowPrevDayHL==today?1:2));
      endShift=iBarShift(_Symbol,_Period,iTime(_Symbol,PERIOD_D1,ShowPrevDayHL==today?0:1));
      for(int i=startShift;i>endShift;i--)
        {
         buff_prevdayhigh[i]=0.0;
         buff_prevdaylow[i]=0.0;
        }
      // Set new time D1
      timeD1=iTime(_Symbol,PERIOD_D1,0);
     }
   // Draw indicator
   startShift=prev_calculated<1?iBarShift(_Symbol,_Period,iTime(_Symbol,PERIOD_D1,ShowPrevDayHL==today?0:1)):(rates_total-prev_calculated-1);
   for(int i=startShift;i>-1;i--)
     {
      buff_prevdayhigh[i]=iHigh(_Symbol,PERIOD_D1,iBarShift(_Symbol,PERIOD_D1,time[i])+1);
      buff_prevdaylow[i]=iLow(_Symbol,PERIOD_D1,iBarShift(_Symbol,PERIOD_D1,time[i])+1);
     }
   return(rates_total);
  }

//+------------------------------------------------------------------+iHighest(NULL,PERIOD_D1,MODE_CLOSE,40,1)];
 
marc700: how do i change it so it gives me yesterday highest "close" not the highest price. and the same for the low. i want the lowest "close" not the lowest price.

You are reading from the D1. There is only one close per bar.

Stop with the D1 and use the current chart. Find yesterday's beginning of the day, end of the day, highest and lowest close.
          Find bar of the same time one day ago - MQL4 programming forum #1 & #6 (2017)

See also Dealing with Time (Part 1): The Basics - MQL5 Articles (2021.10.01)
Dealing with Time (Part 2): The Functions - MQL5 Articles (2021.10.08)
MQL5 Programming Basics: Time - MQL5 Articles (2013.04.26)

 
thanks. will check it out .
Reason: