vdemydiuk / mtapi

MetaTrader API (terminal bridge)
http://mtapi4.net/
MIT License
514 stars 277 forks source link

OrderModify failed with PendingOrders. #117

Open Perens28 opened 6 years ago

Perens28 commented 6 years ago

Hi,

I have issues with OrderModify when I want modify Pending orders.

For example I want change SellStop on GOLD.

apiclient.OrderModify(order.Ticket, 1300, 0, 0, DateTime.MaxValue);

And I get error 130. What I do wrong?

Thanks

KptKuck commented 6 years ago

Hello Perens, look at this page and understud what is error 130. https://book.mql4.com/trading/ordermodify image

I think your new price is to close or against the order direction. Use RefreshRates bevore modify.

Change the price and see what happens

Perens28 commented 6 years ago

In time when I try it, was GOLD about 1330. I try it manually as you can see in first topic and its return error. I solved it by delete order and make new one. But its not comfortable... Thanks for advice

KptKuck commented 6 years ago

Did you modify the correct order ?

KptKuck commented 6 years ago

Enable debug mode in mtapi5.mql5 and send the log output .

Perens28 commented 6 years ago

Yes I modify correct order. This working for you? Mofidy pending orders? If I try modify SL or TP for BUY/SELL its ok. But pending orders not...

KptKuck commented 6 years ago

Iam not the devoloper of this API but i can help you to solve this problem.

Sorry i see that you use mtapi not mtapi5.

Enable debug mode in mtapi.mq4 like this //#define __DEBUG_LOG__ old

define __DEBUG_LOG__ new

compile and run see output and post ist after OrderModify Error

greets