OrderModify error 1

 
if (order_type==OP_SELL) { if(Ask < order_stoploss - 0.00150){ OrderModify(ticket1,order_price, Ask + 0.0005,0,Blue); return ; }}

Why am I getting OrderModify error 1 when this executes?


 
mrchuckw:
if (order_type==OP_SELL) { if(Ask < order_stoploss - 0.00150){ OrderModify(ticket1,order_price, Ask + 0.0005,0,Blue); return ; }}

Why am I getting OrderModify error 1 when this executes?


Can't say without seeing more code, for example, how you set ticket1 and order_stoploss
 
Check your order_stoploss value think that after it modifies the trade it still keeps same value as it has before modifieing the trade...
 

Post more of your code looking at it their might be more errors but for one you should have takeprofit value in the ordermodify. If you are not altering it use ordertakeprofit to leave it the same i.e.

OrderModify(ticket1,order_price, Ask + 0.0005,OrderTakeProfit(),0,Blue);
 
tonny:

Post more of your code looking at it their might be more errors but for one you should have takeprofit value in the ordermodify. If you are not altering it use ordertakeprofit to leave it the same i.e.

tonny: not really

the question is r u using OrderSelect

 
mrchuckw:
if (order_type==OP_SELL) { if(Ask < order_stoploss - 0.00150){ OrderModify(ticket1,order_price, Ask + 0.0005,0,Blue); return ; }}

Why am I getting OrderModify error 1 when this executes?

  1. Based on the above code, how would you know that you're getting any error? What are Function return values ? How do I use them ? - MQL4 forum
  2. What is order_price? Once the order opens, it can't be changed. Once the order opens, it may not be equal to the original price because of slippage. Use OrderSelect()/OrderOpenPrice()
  3. What is order_stoploss. Do you update it after modifying the order? Use OrderSelect()/OrderStopLoss()
  4. EA's must be coded to recover from terminal restarts (BSOD/power/reboot) Do you recreate those variables or are you writing and reading them from a file (persistent storage)
 
qjol:

tonny: not really

the question is r u using OrderSelect


Not just that, the way he is hard coding the values i.e. + or - 0.000... makes the EA incompatible with other symbols. I happen to think there might be more errors so it would help to see more including where the variables originate from and the modification system including order cycling.
Reason: