How to make ModifyPendingOrder works properly?

Created at 07 Jun 2015, 14:46
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
CY

cyrbod

Joined 07.06.2015

How to make ModifyPendingOrder works properly?
07 Jun 2015, 14:46


I'm trying to make my robot works in modifying a pending order, without a success.

Can you help?

Let's have a look in this is a scriptlet in my robot

ModifyPendingOrder(order, sellOrderTargetPrice, 50, TakeProfit, Server.Time.AddSeconds(Threshold * SecondsTimeout));

This is a log

04/06/2015 11:00:04.895 | PendingOrder ID: 50814231 + target price: 2.0784 + trade type: Buy + Ask: 2.0785 + Bid: 2.0731 + Expiration time: 04/06/2015 11:00:16
04/06/2015 11:00:04.973 | Modifying pending order OID50814231 (Volume: 100k, Price: 2.0795, SL: 50, TP: 150, ExpireTime: 04/06/2015 11:00)
04/06/2015 11:00:05.285 | → Modifying pending order OID50814231 (Volume: 100k, Price: 2.0795, SL: 50, TP: 150, ExpireTime: 04/06/2015 11:00) FAILED with error "TechnicalError", PendingOrder OID50814231
04/06/2015 11:00:05.317 | PendingOrder ID: 50814230 + target price: 2.0711 + trade type: Sell + Ask: 2.0784 + Bid: 2.07325 + Expiration time: 04/06/2015 11:00:17

 


@cyrbod
Replies

Spotware
09 Jun 2015, 15:34

Dear Trader,

Could you provide us the corresponding records from the journal tab?


@Spotware

cyrbod
10 Jun 2015, 01:27

RE:

Spotware said:

Dear Trader,

Could you provide us the corresponding records from the journal tab?

Hi, 

Thank you for replying to this post.

Find hereby the required records and some more:

2015.06.04 10:59:58.270 | Stop order to Sell 100k GBPSGD (Price: 2.07110, TP: 2.05610, ExpireDate: 04/06/2015 11:00) is sent to server
2015.06.04 10:59:58.364 | → Stop order OID50814226 to Sell 100k GBPCHF (Price: 1.43328, TP: 1.41828, ExpireDate: 04/06/2015 11:00) is ACCEPTED (04/06/2015 10:59:57.680 UTC+0)
2015.06.04 10:59:58.410 | Stop order to Buy 100k GBPSGD (Price: 2.07840, TP: 2.09340, ExpireDate: 04/06/2015 11:00) is sent to server
2015.06.04 10:59:58.473 | → Stop order OID50814227 to Buy 100k GBPCHF (Price: 1.43587, TP: 1.45087, ExpireDate: 04/06/2015 11:00) is ACCEPTED (04/06/2015 10:59:57.685 UTC+0)
2015.06.04 10:59:58.473 | Stop order to Sell 100k GBPAUD (Price: 1.98870, TP: 1.97370, ExpireDate: 04/06/2015 11:00) is sent to server
2015.06.04 10:59:58.520 | → Stop order OID50814228 to Sell 100k GBPCAD (Price: 1.91875, TP: 1.90375, ExpireDate: 04/06/2015 11:00) is ACCEPTED (04/06/2015 10:59:57.690 UTC+0)
2015.06.04 10:59:58.520 | Stop order to Buy 100k GBPAUD (Price: 1.99146, TP: 2.00646, ExpireDate: 04/06/2015 11:00) is sent to server
2015.06.04 10:59:58.629 | → Stop order OID50814229 to Buy 100k GBPCAD (Price: 1.92148, TP: 1.93648, ExpireDate: 04/06/2015 11:00) is ACCEPTED (04/06/2015 10:59:58.417 UTC+0)
2015.06.04 10:59:58.629 | Stop order to Sell 100k GBPJPY (Price: 191.326, TP: 189.826, ExpireDate: 04/06/2015 11:00) is sent to server
2015.06.04 10:59:58.692 | → Stop order OID50814230 to Sell 100k GBPSGD (Price: 2.07110, TP: 2.05610, ExpireDate: 04/06/2015 11:00) is ACCEPTED (04/06/2015 10:59:58.449 UTC+0)
2015.06.04 10:59:58.692 | Stop order to Buy 100k GBPJPY (Price: 191.579, TP: 193.079, ExpireDate: 04/06/2015 11:00) is sent to server
2015.06.04 10:59:58.723 | → Stop order OID50814231 to Buy 100k GBPSGD (Price: 2.07840, TP: 2.09340, ExpireDate: 04/06/2015 11:00) is ACCEPTED (04/06/2015 10:59:58.517 UTC+0)
2015.06.04 10:59:58.785 | → Stop order OID50814232 to Sell 100k GBPAUD (Price: 1.98870, TP: 1.97370, ExpireDate: 04/06/2015 11:00) is ACCEPTED (04/06/2015 10:59:58.548 UTC+0)
2015.06.04 10:59:58.864 | → Stop order OID50814233 to Buy 100k GBPAUD (Price: 1.99146, TP: 2.00646, ExpireDate: 04/06/2015 11:00) is ACCEPTED (04/06/2015 10:59:58.580 UTC+0)
2015.06.04 10:59:58.926 | → Stop order OID50814234 to Sell 100k GBPJPY (Price: 191.326, TP: 189.826, ExpireDate: 04/06/2015 11:00) is ACCEPTED (04/06/2015 10:59:58.721 UTC+0)
2015.06.04 10:59:58.957 | → Stop order OID50814235 to Buy 100k GBPJPY (Price: 191.579, TP: 193.079, ExpireDate: 04/06/2015 11:00) is ACCEPTED (04/06/2015 10:59:58.792 UTC+0)
2015.06.04 11:00:04.973 | Request to amend order OID50814231 (Price: 2.07950, SL: 2.07450, TP: 2.09450, ExpireDate: 04/06/2015 11:00) is sent to server
2015.06.04 11:00:05.223 | → Request to amend order OID50814231 (Price: 2.07950, SL: 2.07450, TP: 2.09450, ExpireDate: 04/06/2015 11:00) is REJECTED with error "UNKNOWN_ERROR"
2015.06.04 11:00:05.317 | → Stop order to BUY 100k GBPSGD OID50814231 is FILLED at 2.07840, position PID34465498 (04/06/2015 11:00:05.054 UTC+0)
2015.06.04 11:00:06.379 | Request to CANCEL order OID50814230 is sent to server

 


@cyrbod

Spotware
11 Jun 2015, 10:54

Dear Trader,

Could you please provide us your Broker name and the environment type (demo or live)?


@Spotware

cyrbod
11 Jun 2015, 20:48

Hi,

The broker is FxPro

The account is a demo.


@cyrbod

Spotware
16 Jun 2015, 09:24

Dear Trader,

Could you please tell us if you were using async methods? 


@Spotware

cyrbod
17 Jun 2015, 00:30

Hi,

As Mentioned in the first post, this is the API using

ModifyPendingOrder(order, sellOrderTargetPrice, 50, TakeProfit, Server.Time.AddSeconds(Threshold * SecondsTimeout));

I suppose it's synchronous vs ModifyPendingOrderAsync which seems to be async.


@cyrbod

Spotware
17 Jun 2015, 12:46

Dear Trader,

Your cBot was trying to modify an order at the moment when it was triggered at the Server side. Will will consider providing a more informative error instead of "UNKNOWN_ERROR". 

 


@Spotware

cyrbod
08 Jul 2015, 02:00

How to make ModifyPendingOrder works properly?

Hello Dear,

Is this relevant to explain why the API seems not working?

04/06/2015 11:00:04.895 | PendingOrder ID: 50814231 + target price: 2.0784 + trade type: Buy + Ask: 2.0785 + Bid: 2.0731 + Expiration time: 04/06/2015 11:00:16

04/06/2015 11:00:04.973 | Modifying pending order OID50814231 (Volume: 100k, Price: 2.0795, SL: 50, TP: 150, ExpireTime: 04/06/2015 11:00)

The first line is due to my own desire to what behind the scene.

The latter is by the robot is started ModifyPendingOrder.

When logging data before calling the API ModifyPendingOrder, you can find the right expiration time with the whole pattern 

hh:mi:ss

But, the dump of the robot give me .ExpireTime: 04/06/2015 11:00 with the time pattern

hh:mi

 I'd lost the seconds which are relevant for this modification.


@cyrbod

Spotware
08 Jul 2015, 10:18

Dear Trader,

As you probably already noticed the pending orders expire on a second specified time. The log message that you receive shows the expiration time without seconds indeed. We will improve the logging to include also the seconds in the expiration time in one of our future releases.


@Spotware