Is there a bug or change in MQL5 update? Having problem with iHighest / iLowest functions

 

Another thread with the same issue in OOP class https://www.mql5.com/en/forum/467428

Now today I am trying to run an indicator where Highest values are calculated and I am getting price much lower than the Highest price.

double   price1  = iHigh(gSymbol,PERIOD_H1,iHighest(gSymbol,_Period,MODE_HIGH,28,iBarShift(gSymbol,_Period,FxSession[i][pID].Begin,false)));

I have used the indicator earlier, with the correct results.

Just trying to reconfirm, if there is new bug/change in the MQL function as it is happening at two different codes.

regards.

Different results from ArrayMaximum/ArrayMinimum on same time set of data!!!
Different results from ArrayMaximum/ArrayMinimum on same time set of data!!!
  • 2024.05.23
  • Anil Varma
  • www.mql5.com
Hi Please help me out to debug problem/error in my code...
Files:
MqlBug001.png  91 kb
 

According to iBarShift documentation:

exact=false

[in]  A return value, in case the bar with the specified time is not found. If exact=false, iBarShift returns the index of the nearest bar, the Open time of which is less than the specified time (time_open<time). If such a bar is not found (history before the specified time is not available), then the function returns -1. If exact=true, iBarShift does not search for a nearest bar but immediately returns -1.


 

Write down the expected values ​​from FxSession[i][pID].Begin, iBarShift, iHighest and iHigh somewhere. Print all these values ​​into a log and compare them to the expected values. This way you localize the problem.

In the meantime, this looks like a question for psychics.

 
Better yet, find these bars/values ​​yourself, without using built-in high-level functions
 
Anil Varma:

Another thread with the same issue in OOP class https://www.mql5.com/en/forum/467428

Now today I am trying to run an indicator where Highest values are calculated and I am getting price much lower than the Highest price.

I have used the indicator earlier, with the correct results.

Just trying to reconfirm, if there is new bug/change in the MQL function as it is happening at two different codes.

regards.

You only copied the price.. the index has changed on truncated price data after the copy
 
Anil Varma:
double   price1  = iHigh(gSymbol,PERIOD_H1,iHighest(gSymbol,_Period,MODE_HIGH,28,iBarShift(gSymbol,_Period,FxSession[i][pID].Begin,false)));

You find the bar index on the current timeframe, and call iHigh for H1, passing the bar index from the current timeframe

 
Vladislav Boyko #:

You find the bar index on the current timeframe, and call iHigh for H1, passing the bar index from the current timeframe

Thank you everyone for your time to reply.

@Vladislav Boyko you caught the right problem. I did change PERIOD_H1 to _Period in iHighest() but forgot to change the same in iHigh(). Seems I needed a break :)

Can you please look into another thread also, seems I must have made some silly mistake which I am not able to trace.

THANKS A LOT.

 
Sardion Maranatha #:
You only copied the price.. the index has changed on truncated price data after the copy

Hi @Sardion Maranatha

Is your reply relates to earlier thread at https://www.mql5.com/en/forum/467428?

If true, please elaborate what did you mean in the same thread, instead of here.

Thanks a lot

Different results from ArrayMaximum/ArrayMinimum on same time set of data!!!
Different results from ArrayMaximum/ArrayMinimum on same time set of data!!!
  • 2024.05.23
  • Anil Varma
  • www.mql5.com
Hi Please help me out to debug problem/error in my code...
 
Anil Varma #:

Hi @Sardion Maranatha

Is your reply relates to earlier thread at https://www.mql5.com/en/forum/467428?

If true, please elaborate what did you mean in the same thread, instead of here.

Thanks a lot

Yes the earlier thread