iHigh(Symbol(),PERIOD_D1,0) is giving me Highest close

 

I am having the above problem.

I have coded iHigh(Symbol(),PERIOD_D1,0) in order to have todays highest price. 

But instead the display on the chart of the result of code shows it is giving the highest close.

This could be an empty 4 problem

 
Bwalya Tambule:

I am having the above problem.

I have coded iHigh(Symbol(),PERIOD_D1,0) in order to have todays highest price. 

But instead the display on the chart of the result of code shows it is giving the highest close.

This could be an empty 4 problem

Highest close of what?

 
On MT4: Unless the current chart is that specific pair/TF referenced, you must handle 4066/4073 errors before accessing prices.
          Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
 
Keith Watford:

Highest close of what?

close of Hour Candle.
 

I found a way around it. The EA is using Hr 1 trading time frame.

So I got Hr1 bar shift at days open and then highest Hr bars from then on.

Works fine

 

You can also check out

iHighest(....
 
Marco vd Heijden:

You can also check out

below is code of what I did.

//
      double TodaysHigh()
   {
      int HighBarH1 = iHighest(Symbol(), PERIOD_H1,MODE_HIGH,Day0Bar(),0);

       return(iHigh(Symbol(),PERIOD_H1,HighBarH1) );
    }   
//
      double TodaysLow()
   {
      int LowBarH1 = iLowest(Symbol(), PERIOD_H1,MODE_LOW,Day0Bar(),0);
       return(iLow(Symbol(),PERIOD_H1,LowBarH1) );
    }   

Reason: