Support Board
Date/Time: Sun, 24 Nov 2024 20:05:33 +0000
Post From: ACSIL: modify order
[2013-11-06 08:43:26] |
User40073 - Posts: 23 |
I coded this snippet to get real order ID, and if I havent got running order, get back zero. int GetOrderID(SCStudyInterfaceRef sc)
{ int Index = 0; int ID=0; s_SCTradeOrder OrderDetails; while( sc.GetOrderByIndex (Index, OrderDetails) != SCTRADING_ORDER_ERROR) { Index++; // Increment the index for the next call to sc.GetOrderByIndex if (OrderDetails.OrderStatusCode != SCT_OSC_OPEN && OrderDetails.OrderStatusCode != SCT_OSC_FILLED) continue; if (OrderDetails.ParentInternalOrderID != 0) continue; //Get the internal order ID ID = OrderDetails.InternalOrderID; } sc.GetOrderByOrderID(ID, OrderDetails); if (OrderDetails.OpenClose == OCE_CLOSE) ID=0; return(ID); } Its ok, but I use attached orders, upset the whole code block. Is there any easy way to get no order, all closed. (no stop/limit, openedetc...) Other question is, how to get attached orders ID(takeprofit, stoploss) via OrderID? I'd like to get my TP/SL prices. thanks! |