Copying timeseries and getting Max

 
ArrayCopy(PeriodHigh, High, 0, i+5, 25);
double Max = ArrayMaximum(PeriodHigh, 0, WHOLE_ARRAY);

I want to select a period of 5 days before the current day in an array. Then after that I want to know what is the highest value of that given period. Somehow though, my code doesn't quit work the way I want it to work, and I think it is because of either one of the two lines above. Can anyone please explain to me whether there is something wrong there.

 
 int Max = ArrayMaximum(PeriodHigh, 0, WHOLE_ARRAY);
 double MaxHigh=PeriodHigh[Max];

Please also study: https://www.mql5.com/en/docs/series/copyhigh

Documentation on MQL5: Timeseries and Indicators Access / CopyHigh
Documentation on MQL5: Timeseries and Indicators Access / CopyHigh
  • www.mql5.com
Timeseries and Indicators Access / CopyHigh - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: