Download MetaTrader 5

MQL4 Pending Orders Wont Open

To add comments, please log in or register
LanceHardwood
36
LanceHardwood  

I have been working on my expert advisor and have tried to open a pending order. i keep on getting error 130 (invalid goals), so i set my goals to 0 and then added a little script that closes all orders manually. I still get error 130(invalid goals), is MQL4 trolling me?!


      case(OP_SELL):
      {
            PosSizeShort = -((OpenShorts * GLval - OpenLongs * GSval - AmntPROFIT)/GLval)+1;
            int Ticket = OrderSend(Symbol(), OP_BUYSTOP, (double)PosSizeLong, Price, 5, 0, 0);
             if(Ticket < 0){Alert("order failes error #", GetLastError());}
             else{Alert("Order placed succesfully");}


      }


btw i have opened an order before with the goals that use to have on this one and that order executes perfectly like it's supposed to.

LanceHardwood
36
LanceHardwood  
btw "price" is just the Ask value saved under a variable (which is the price variable)
Siti Latifah
11849
Siti Latifah  

RunningPrice + Distance (po_stop price) >= StopLevel

To add comments, please log in or register