Support Board
Date/Time: Sun, 11 May 2025 19:32:37 +0000
Automated trading issues canceling or modifying orders
View Count: 2406
[2016-02-17 22:27:18] |
flyboy615 - Posts: 56 |
Hi, I recently upgrade to version 1362 from 1353 and I'm noticing some issues with several of the automated systems I have running. In prior versions either canceling or moving an open resting order would work correctly. To do this I keep track of the order id in a persistent variable and move or cancel as required. In 1363 the orders no longer cancel. I cannot reproduce this behavior during replay but only in simulation. There is no error message other then "Chart: 6AH6 5 Min #3 | Study: Test | Failed to clean up existingt order prior to sell. | 2016-02-17 08:55:09 *" which I beleive is unrelated since the orphaned order actually occurs later. What has changed since that version that I missed? I reviewed the new changes on the only thing that might have remotely related is in version 1354 Thanks |
[2016-02-17 23:20:51] |
|
You need to debug the problem yourself and tell us specifically what the issue is. All of this is nonspecific. If you are modifying or canceling order, what is the error value returned. What does the Trade >>Trade Activity Log >> Trade Activity tab indicate for the order? This is all that matters. Everything else is not useful for us. And furthermore, the message you gave is your own message. Not ours. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2016-02-18 01:35:33
|
[2016-02-25 01:49:55] |
flyboy615 - Posts: 56 |
ok I now have had time to debug further. It would seem that the functionality surrounding the GetOrderByOrderID may be the cause. Prior to the upgrade when the order was open on the screen the order status would identify the order as SCT_OSC_OPEN. The same code in the same situation now shows the ShortPosition.OrderStatusCode = SCT_OSC_FILLED. I have a valid order id stored in a Persist var. Here is a stripped down version covering the essentials. there is a lot of code between the steps but gives my basic logic. The example int& ShortOrderId = sc.PersistVars->Integers[11]; s_SCTradeOrder ShortPosition; //place the short order ReturnInd = sc.SellEntry(ShortOrder); if(ReturnInd > 0 ) { ShortOrderId = ShortOrder.InternalOrderID; // set the ID } else{ ShortOrderId = 0; } //later in the process verify the status int intSOrder = sc.GetOrderByOrderID(ShortOrderId,ShortPosition); if (ShortPosition.OrderStatusCode == SCT_OSC_OPEN && bCancelOrder) { sc.CancelOrder(ShortOrderId); } I may have misused something in the beginning that suited the purpose at that time and now has been fixed but this logic had been functional for several years. Thanks |
[2016-02-25 02:30:09] |
|
s_SCTradeOrder::OrderStatusCode is set to the current order status of the requested order held in the order list in Sierra Chart. Ultimately this value is controlled by the external trading service. If it is invalid, then we need you to show this to us through the Trade Activity Log: https://www.sierrachart.com/index.php?page=doc/doc_TradeActivityLog.php#TradeActivityLogToSupport And not through an ACSIL trading system. Our impression is there is no problem here. Also there were no changes to our knowledge which would have changed anything related to this. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2016-02-25 02:31:09
|
[2016-02-25 11:40:41] |
flyboy615 - Posts: 56 |
In this case the debugging was done using chart replay so no 3rd party was involved. I've attached the attached the simulated trade activity log and the .DAT file from yesterday. The symbol in question is 6AH6 and the time frame where the system was trying to cancel the trade was post 9:40. The system works with resting orders sell stop limit orders. you will see the order canceled at 1604 when I canceled it manually, where as the system was suppose to have canceled the order on the 10:00 bar based on internal conditions. Again nothing had changed for the last 2 years so not a recent bug I had added in. I have a couple of clients with the same problem using the same logic in systems I had created for them and nothing has changed in those systems for over a year.
|
Private File Private File |
[2016-02-25 19:07:03] |
|
What time zone are you referring to? Provide us a specific Internal Order ID to look at. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2016-02-25 20:02:11] |
flyboy615 - Posts: 56 |
Order was placed a 9:40 EST internal order ID 164758; buy 3 contracts;2 targets and a stop all using triggered trailing stops. Can provide the twconfig file if required. Resting sell stop limit order at 0.7139 System attempted to cancel at the close of the 10:00 bar and failed (I will attempt the see the error # if one exists tonight) Manually canceled the order 16:04 All of this was done in chart replay. |
[2016-02-25 20:17:06] |
|
We need more information. What is the symbol. We also do not see any Internal Order ID 164758. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2016-02-26 11:32:15] |
flyboy615 - Posts: 56 |
The symbol is 6AH6. the order ID came out of the trade activitylog.text ant the timestamp is 9:40 Give me a few day and I"ll try and put a simple study together that demonstrates the problem that will be simpler for everyone. |
[2016-02-26 18:25:41] |
|
No, we do not want a simple study. We just need to look at the Trade Activity Log. Our procedures must be followed unless we ask for more information. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2016-02-28 15:06:12] |
flyboy615 - Posts: 56 |
The change seems to have been introduced in the release of 1342, meaning in 1341 it worked and 1342 it didn't, and debugging would suggest that the issue is an incorrect order status code returned from the s_SCTradeOrder object retrieved by using the GetOrderByOrderID. What I did was to backtrack to a point where everything worked and then roll forward one version at a time, rebuilding my study each time, until the change was introduced.
|
[2016-02-28 22:37:51] |
|
We now looked at the text log you provided and found the order with Internal Order ID 164758. All of the order statuses are correct for the order. What is the particular order status code that is getting returned by GetOrderByOrderID and why do you say that it is incorrect? Just before you cancel the order from ACSIL, get the order status just before that and let us know what it is. And tell us what the return value is from the function you are using the cancel the order. Also are there any error messages displayed in Trade >> Trade Service Log at the time you are trying to cancel the order? We need to know that as well. Here is the procedure to debug an automated trading system: http://www.sierrachart.com/index.php?page=doc/doc_ACSILTrading.html#DebuggingTradingSystems There are two new order statuses for Pending Child orders. But the order in question is not a child order. It is very unlikely there is anything wrong with the order status and we are not aware of any changes which would cause a problem. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2016-02-28 22:39:10
|
[2016-02-28 23:49:35] |
flyboy615 - Posts: 56 |
The order status is showing as filled when I get the order via the GetOrderByOrderID, whereas the trade on the chart is still open having not been filled. What I see on the chart is as expected so order placement has no issues. It is only retrieving the status as in the previous post that is not correct. As mentioned earlier this changed with the 1342 release.
|
[2016-02-29 00:26:34] |
|
A new order status code for child orders has been added and this would affect existing compiled trading code in newer versions of Sierra Chart. We had not thought of that. For example when the order status is SCT_OSC_OPEN, code using the old enumerations would think it is SCT_OSC_PENDINGMODIFY. In the current version of Sierra Chart you just need to recompile your trading system using the current header file, which happens by default when using the Sierra Chart custom study build system. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2016-02-29 00:27:13
|
[2016-02-29 01:13:18] |
flyboy615 - Posts: 56 |
I can confirm that 1374 no longer has that issue. Thanks For your help.
|
To post a message in this thread, you need to log in with your Sierra Chart account: