# [Error] Array out of range

33

Hello everyone,

I'm just learning how to code a EA, I'm very happy if someone explain this error for me

This is my mini func

```int Lenhmua(int Loailenh,short x, short y)
{

{
if (y==0)
else GiaB[x][y]=GiaB[x][y-1]-Pips*Point;
IDB_Tien[x][y]=OrderSend(Tien[x],Loailenh,Lots,NormalizeDouble(GiaB[x][y],Digits),0,0,GiaB[x][y]+Pips*Point,NULL,3453,0,clrNONE);
};
return(IDB_Tien[x][y]);
};

int Lenhban(int Loailenh,short x, short y)
{

if (Loailenh==OP_SELL || Loailenh==OP_SELLLIMIT )
{
if (y==0 && y>0)
GiaS[x][y]=MarketInfo(Tien[x],MODE_BID);
else GiaS[x][y]=GiaS[x][y-1]+Pips*Point;
IDS_Tien[x][y]=OrderSend(Tien[x],Loailenh,Lots,NormalizeDouble(GiaS[x][y],Digits),0,0,GiaS[x][y]-Pips*Point,NULL,3453,0,clrNONE);
};
return(IDS_Tien[x][y]);
};```

And this is my Main EA

```void start()
{
for (i = 0; i<=5;i++)
{
RefreshRates();
while (IDB_Tien[a[i]][0] <=0)
{
};
Sleep(500);
while (IDS_Tien[a[i]][0] <=0)
{
IDS_Tien[a[i]][0]= Lenhban(OP_SELL,a[i],0);
};
Sleep(2000);
while (IDB_Tien[a[i]][1] <=0)
{
};
Sleep(500);
while (IDS_Tien[a[i]][1] <=0)
{
IDS_Tien[a[i]][1]= Lenhban(OP_SELLLIMIT,a[i],1);
};
};
return;
};```

Thank you so much.

P/s: If i just use mini func alone, everything is ok so i don't think the problems is in the mini func

16304

 kissmez: I'm very happy if someone explain this error for me You know what the error is. Your index into some array is negative or greater or equal to the array size.We can't help further because we don't know which array, its size, or the index.Use the debugger or Print out your variables, and find out why.
33

whroeder1:
 You know what the error is. Your index into some array is negative or greater or equal to the array size.We can't help further because we don't know which array, its size, or the index.Use the debugger or Print out your variables, and find out why.
Oh. Thank you so much. I fixed it :D