# EA not opening pending orders

9

Hi all.

I am trying to develop an EA that opens different orders at different prices with the same TP but for some reason it doesn't seem to work (I am a newbie in programming). When I test it, the error resides in the price and the take profit for the ordersend(). I understand that they have to be normalized first, but there is obviously something that I am doing wrong and can't seem to find what.

Any help is very appreciated.

```void OnTick()
{

double rates[][6];
double weekly_close = rates[1][4];
double weekly_high = rates[1][3];
double weekly_low = rates[1][2];
double R = weekly_high - weekly_low;//range
double wp = (weekly_high + weekly_low + weekly_close)/3;// Standard Pivot
double wr4 = wp + (R * 1.382);
double wr3 = wp + (R * 1.000);
double wr2 = wp + (R * 0.786);
double wr1 = wp + (R * 0.618);
double ws1 = wp - (R * 0.618);
double ws2 = wp - (R * 0.786);
double ws3 = wp - (R * 1.000);
double ws4 = wp - (R * 1.382);

double price1=NormalizeDouble(wr1,5);
double price2=NormalizeDouble(wr2,5);
double price3=NormalizeDouble(wr3,5);
double price4=NormalizeDouble(wr4,5);
double price5=NormalizeDouble(ws1,5);
double price6=NormalizeDouble(ws2,5);
double price7=NormalizeDouble(ws3,5);
double price8=NormalizeDouble(ws4,5);
double lots = 0.01;
double takeprofit=NormalizeDouble(wp,5);

if (OrdersTotal()==0)
{
int ticket1=OrderSend(Symbol(), OP_SELLLIMIT, lots, price1, 3,0,takeprofit, NULL, 0, 0, clrNONE);
int ticket2=OrderSend(Symbol(), OP_SELLLIMIT, lots, price2, 3,0,takeprofit, NULL, 0, 0, clrNONE);
int ticket3=OrderSend(Symbol(), OP_SELLLIMIT, lots, price3, 3,0,takeprofit, NULL, 0, 0, clrNONE);
int ticket4=OrderSend(Symbol(), OP_SELLLIMIT, lots, price4, 3,0,takeprofit, NULL, 0, 0, clrNONE);
int ticket5=OrderSend(Symbol(), OP_BUYLIMIT, lots, price5, 3,0,takeprofit, NULL, 0, 0, clrNONE);
int ticket6=OrderSend(Symbol(), OP_BUYLIMIT, lots, price6, 3,0,takeprofit, NULL, 0, 0, clrNONE);
int ticket7=OrderSend(Symbol(), OP_BUYLIMIT, lots, price7, 3,0,takeprofit, NULL, 0, 0, clrNONE);
int ticket8=OrderSend(Symbol(), OP_BUYLIMIT, lots, price8, 3,0,takeprofit, NULL, 0, 0, clrNONE);
}

}```
20207

```double rates[][6];
double weekly_close = rates[1][4];```
Your array has no size. Therefor the first access is array exceeded. You would know that had you used strict.

Always use strict. Fixing the warnings will save you hours of debugging.

9

Thank you William!