Modify Error 3: ERR_INVALID_TRADE_PARAMETERS

 

I have two existing trades that I am trying to modify. At the time of modification, the new order parameters are as shown below. I get Modify error 3 (ERR_INVALID_TRADE_PARAMETERS). Can't tell why. For the buy-stop order below, the OrderPrice is higher than current Ask by more than the STOP_TRADE_DISTANCE and the SL and TP are also set correctly, at least direction-wise. For sell-stop order, the new order price is below the current Bid but same error. Have checked expiration, it's at least 5 minutes away from the time of modification. Can one of you look at this and point at what I am not setting correctly? I can provide more details as necessary.

   -----------------

   Buy-Stop Trade

   -----------------

   Bid = 1.05788, Ask = 1.05791, Order Type: BUY-Stop, New_OrderPrice = 1.05868, New_SL = 1.05845, New_TP = 1.06868


   -----------------

   Sell-Stop Trade

   -----------------

   Bid = 1.05229, Ask = 1.05232, Order Type: SELL-Stop, New_OrderPrice = 1.052, New_SL = 1.05223, New_TP = 1.042


 

Looks like it has something to do with expiration. If I set the new expiration to be at least 10 minutes away, the error goes away. If I keep the original expiration, which is less than 10 minutes away from the time of modification, it gives the error. I found 10 at the threshold by trial and error. Is there any PARAM in MQL4 that can be used to retrieve this threshold for the broker?

 

What kind of instrument you use?

I assume you would place the order on the chart but i did not work.

First enlarge the amount of TP and the SL....., the markt is open?

 
Juergen Frank:

What kind of instrument you use?

I assume you would place the order on the chart but i did not work.

First enlarge the amount of TP and the SL....., the markt is open?

how is your ordersend command ?

 
Siti Latifah:

how is your ordersend command ?

Why I ask for it ......
If you change the parameters, changed a lot and the error message is no longer available then this can be narrowed down more precisely.
The message could also come from the fact that the broker has certain limits that have been exceeded.

Reason: