double LargestBarSize(NULL,0)
{
MqlRates PriceInfo[];
ArraySetAsSeries(PriceInfo,true);
int Data = CopyRates(NULL,0,0, 100,PriceInfo);
double low[],high[];
ArraySetAsSeries(low,true);
ArraySetAsSeries(high,true);
int Lcopied = CopyLow(NULL,0,0,35,low);
int Hcopied = CopyHigh(NULL,0,0,35,high);
double Delta[];
ArraySetAsSeries(Delta,true);
int SizeDelta=ArraySize(Delta);
int Sizelow= ArraySize(low);
int Sizehigh=ArraySize(high);
int newSizeDelta =MathMin(Sizelow,Sizehigh);
ArrayResize(Delta,newSizeDelta,0);
ArrayResize(low,newSizeDelta,0);
ArrayResize(high,newSizeDelta,0);
for (int i=0; i<= newSizeDelta +1;i++)
{
Delta[i] = high[i]-low[i];//<-----------------------------------------------Array out of range Error
}
int maxidx = ArrayMaximum(Delta,pStart,pBars);
double LargestBar =PriceInfo[maxidx].high-PriceInfo[maxidx].low;
return (LargestBar);
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
I cannot seem to be able to investigate the array out of range error
in the following code sniplet :