Order not executed - why and how to check programmatically

All posts which do not fit into any other sections of the forum.

Moderator: admin

Order not executed - why and how to check programmatically

Postby Loggy48 » Tue Oct 24, 2017 1:08 pm

I had a problem today which I cannot see why it happened. My strategy opened a long position that included a stoploss but no limit. When the time came to close the position, again programmatially, the order was not executed which left strategy knowing that the trade was still open but with a pending order.

Here is an extract from the log file that the strategy writes - these are written by the AsyncOperationFinished function as a result of a callback from the platform:
Code: Select all
10/24/2017 04:04:00: 3 TRADE_EVENT Open trade 29201758 found with current net profit -0.1

That is the order opened. Then a few hours later the strategy wrote a close order:
Code: Select all
10/24/2017 07:52:02: 1 1.1755/1.17549 close order for trade 29201758 sent: G10R1_5C0FA676207E7EE0E053E12A3C0AE6B8_10212017140501558337_K7W4-100550 with CustomID = EURUSD.m1.513596
10/24/2017 07:52:02: 1 ORDER_EVENT found type C [Close] Status P [In process] ORDER_EVENT false 97589815 P G10R1_5C0FA676207E7EE0E053E12A3C0AE6B8_10212017140501558337_K7W4-100550
10/24/2017 07:52:02: Total orders for this session waiting = 1
10/24/2017 07:52:02: 1 ORDER_EVENT found type C [Close] Status U [Pending calculated] ORDER_EVENT false 97589815 U G10R1_5C0FA676207E7EE0E053E12A3C0AE6B8_10212017140501558337_K7W4-100550
10/24/2017 07:52:02: Total orders for this session waiting = 1


So the Close order is initially "In Process" then "Pending Calculated" but never Executing, Waiting, Cancelled, Rejected etc according to the FixStatus entry in the Orders table.

The count of orders waiting is the Stop order which has not been executed so clearly the Close order has been removed even though it was not executed. If the Close order were still waiting to be executed, that count would be 2.

The Messages shows:

Code: Select all
10/24/2017 07:52 Notification: Order 97589815 not executed


My questions are

a) why should this occur. There was no reason for the platform not to obey the close order as far as I can see, there was no Limit set and the StopLoss was way below the price at the time

and b) what is the best way to trap this - is it to include a check when an order has been placed that it has been executed, or that it still exists? I I know this, I can keep the position open instead of in limbo so that the strategy can re-issue the close order or take alternative action.
Loggy48
 
Posts: 79
Joined: Tue Jun 24, 2014 8:39 am
Location: Manchester, UK

Re: Order not executed - why and how to check programmatical

Postby Konstantin.Toporov » Tue Oct 24, 2017 3:21 pm

Are you still able to see the order in FXTS?
Also can you send me logs from FXTS?
The located in "log" folder of FXTS home directory.
Konstantin.Toporov
 
Posts: 70
Joined: Mon Aug 31, 2015 10:16 am


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 3 guests