MQL4 Pending Orders Wont Open

 

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.

 
btw "price" is just the Ask value saved under a variable (which is the price variable)
 

RunningPrice + Distance (po_stop price) >= StopLevel

Reason: