Login Page - Create Account

Support Board


Date/Time: Tue, 07 May 2024 15:01:40 +0000



[Programming Help] - missing data in s_SCTradeOrder

View Count: 1046

[2019-05-17 11:52:18]
PK - Posts: 12
Hi,

-I get trade information using s_SCTradeOrder
-I have an attached entry order with 1 StopAllOrder, and 3 Target Orders
-The entry order already filled but the entry order quantity just equal the Third Target Order quantity (it should be the sum of all 3 Target Orders' quantity)
-I read your documentation and found that when using StopAllOrder, the Stop order is automatically generated for every Target order, so I got the InternalOrderID for every Stop Order in addition to StopAllOrderID.
-I use InternalOrderID for target orders and stop orders to get the detail information using s_SCTradeOrder, but there is no information when I use Stop1InternalOrderID, Stop2InternalOrderID, Stop3InternalOrderID.

So, in summary, there are two key problems:

1. Filled Entry Order quantity is mismatching with position quantity (just equal Third Target Order quantity)

2. There is no information for Stop1, Stop2, Stop3 order

Please see the code below:

//Getting Trade information
s_SCTradeOrder OrderDetails;
if (sc.GetOrderByOrderID(i_NewOrderID,OrderDetails) !=SCTRADING_ORDER_ERROR && OrderDetails.InternalOrderID!=0)
{
}

s_SCTradeOrder Target1OrderDetails;    
if (sc.GetOrderByOrderID(i_TargetOrderID1,Target1OrderDetails) !=SCTRADING_ORDER_ERROR && Target1OrderDetails.InternalOrderID!=0)
{
}

s_SCTradeOrder Target2OrderDetails;    
if (sc.GetOrderByOrderID(i_TargetOrderID2,Target2OrderDetails) !=SCTRADING_ORDER_ERROR && Target2OrderDetails.InternalOrderID!=0)
{
}

s_SCTradeOrder Target3OrderDetails;    
if (sc.GetOrderByOrderID(i_TargetOrderID3,Target3OrderDetails) !=SCTRADING_ORDER_ERROR && Target3OrderDetails.InternalOrderID!=0)
{
}

s_SCTradeOrder StopAllOrderDetails;
if (sc.GetOrderByOrderID(i_StopAllOrderID,StopAllOrderDetails) !=SCTRADING_ORDER_ERROR && StopAllOrderDetails.InternalOrderID!=0)
{
}

s_SCTradeOrder Stop1OrderDetails;
if (sc.GetOrderByOrderID(i_StopOrderID1,Stop1OrderDetails) !=SCTRADING_ORDER_ERROR && Stop1OrderDetails.InternalOrderID!=0)
{
}

s_SCTradeOrder Stop2OrderDetails;
if (sc.GetOrderByOrderID(i_StopOrderID2,Stop2OrderDetails) !=SCTRADING_ORDER_ERROR && Stop2OrderDetails.InternalOrderID!=0)
{
}

s_SCTradeOrder Stop3OrderDetails;
if (sc.GetOrderByOrderID(i_StopOrderID3,Stop3OrderDetails) !=SCTRADING_ORDER_ERROR && Stop3OrderDetails.InternalOrderID!=0)
{
}
[2019-05-17 12:56:10]
Sierra Chart Engineering - Posts: 104368
You must be doing something wrong. The first thing is to check to make sure that s_SCNewOrder::Stop1InternalOrderID is nonzero immediately after the order is submitted.
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
[2019-05-17 14:54:38]
PK - Posts: 12
You're right, I missed to store values into these variables.
How's about the entry order quantity? it does not equal to Position quantity (sum of all 3 targets' quantity), it is the third target quantity.
[2019-05-18 18:39:23]
Sierra Chart Engineering - Posts: 104368
To understand the quantities, refer to the section here about how orders are split:
Attached Orders: OCO Group (Group)
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
[2019-05-21 06:09:29]
PK - Posts: 12
Thanks. I read over it and understood how you split the entry orders. I have another question, if the entry order split into parent orders base on the number of OCO groups, so how the average fill price of the total order is calculated?
[2019-05-22 00:57:59]
Sierra Chart Engineering - Posts: 104368
Where do you see this average price?
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
[2019-05-22 07:53:49]
PK - Posts: 12
In my example of 3 OCO groups, every OCO group's parent order has its own quantity and average fill price, and the entry order is the same as the third OCO group's parent order. Usually, all the 3 parent orders get filled at the same time, so they have the same fill price, but in case all 3 parent orders has different fill price, then how's the average fill price of the total entry order (sum of 3 parent orders), where can I get it? Initially I suppose the entry order's average fill price is the one, but it is the same with the third parent order.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account