Support Board
Date/Time: Fri, 01 Nov 2024 00:14:20 +0000
OCO_LIMIT_STOP_ORDER with attached target and stop orders
View Count: 796
[2017-02-21 22:22:45] |
User953407 - Posts: 5 |
// Create an s_SCNewOrder object. s_SCNewOrder NewOrder; NewOrder.OrderQuantity = 1; NewOrder.OrderType = SCT_ORDERTYPE_OCO_LIMIT_STOP; NewOrder.Price1 = limitPrice; NewOrder.Price2 = stopPrice; NewOrder.TimeInForce = SCT_TIF_DAY; //Specify a Target and a Stop. We are specifying one Target and one Stop, additional targets and stops can be specified as well. NewOrder.Target1Offset = limitOrder_Target_Offset; NewOrder.Target1Offset_2 = stopOrder_Target_Offset; NewOrder.Stop1Offset = stopOrder_Stop_Offset; NewOrder.Stop1Offset_2 = stopOrder_Stop_Offset; I am specifying an order as above. When the order gets executed I get the IDs of the attached orders. if (Result > 0) //If there has been a successful order entry, then draw an arrow at the low of the bar. { // Remember the order IDs for subsequent modification and cancellation Target1OrderID = NewOrder.Target1InternalOrderID; Stop1OrderID = NewOrder.Stop1InternalOrderID; Target2OrderID = NewOrder.Target1InternalOrderID_2; Stop2OrderID = NewOrder.Stop1InternalOrderID_2; } The when the position is not 0, I am checking which orders are live and I get all four of them!!! by checking if sc.GetOrderByOrderID(Target1OrderID, ExistingOrder) != SCTRADING_ORDER_ERROR How can this be true? |
[2017-02-22 02:59:58] |
Sierra Chart Engineering - Posts: 104368 |
The only way to know if the order is actually working and can fill is to use this function: https://www.sierrachart.com/index.php?page=doc/ACSILTrading.html#IsWorkingOrderStatusNoChild This is not the right method: sc.GetOrderByOrderID(Target1OrderID, ExistingOrder) != SCTRADING_ORDER_ERROR
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 |
[2017-02-22 08:06:20] |
User953407 - Posts: 5 |
In this case, could you please let me know what is the best way to find out which of the two orders in the SCT_ORDERTYPE_OCO_LIMIT_STOP has been executed? Thanks a lot. |
[2017-02-22 10:57:48] |
Sierra Chart Engineering - Posts: 104368 |
You need to look at the OrderStatusCode of the order to see if the order has filled: Automated Trading From an Advanced Custom Study: s_SCTradeOrder Structure Members You can get the order details with this function: Automated Trading From an Advanced Custom Study: sc.GetOrderByOrderID 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 |
[2017-02-22 11:58:00] |
Marmany - Posts: 307 |
1)I am having an issue where a study is interpreting live attached orders as being scale in orders. My code has been adapted from that in tradingsystem.cpp and uses != SCTRADING_ORDER_ERROR. In tradingsystem.cpp none of the examples contain the IsWorkingOrderStatusNoChild function. Is it a recent addition? 2) In the Manual the code example is: //Order is considered working if (IsWorkingOrderStatusNoChild(ExistingOrder.OrderStatusCode)) { } Should that be sc.IsWorking.......? Please advise |
[2017-02-22 18:24:09] |
Sierra Chart Engineering - Posts: 104368 |
Is it a recent addition?
No. It just was never documented until recently.Should that be sc.IsWorking.......? 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: 2017-02-22 18:24:22
|
To post a message in this thread, you need to log in with your Sierra Chart account: