Support Board
Date/Time: Tue, 22 Apr 2025 02:30:38 +0000
[Programming Help] - Cheking move of attached Stop order to breakeven in ACSIL
View Count: 208
[2025-01-18 15:32:48] |
gtaranti - Posts: 94 |
In my ACSIL trading system I'm struggling to detect If the attached stop order has been moved to breakeven after the trigger. I see in the Trade Activity Log that when the trigger price for the breakeven is touched, the Stop Order Price is modified to the new price. That's why I'm using the following code hoping to detect when the order is modified but it's not working: s_SCTradeOrder Stop1TradeOrder; SCOrderStatusCodeEnum StopOrderStatusCode; if (sc.GetOrderByOrderID(Stop1OrderID, Stop1TradeOrder) != SCTRADING_ORDER_ERROR) { StopOrderStatusCode = Stop1TradeOrder.OrderStatusCode; } if (StopOrderStatusCode == SCT_OSC_PENDINGMODIFY) { StopWentToBreakeven = 1; sc.AddMessageToLog("--->STOP Moved to Breakeven", 0); }; if (StopOrderStatusCode == SCT_OSC_FILLED) { sc.AddMessageToLog("--->STOP ORDER FILLED", 0); // <-- THIS WORKS... } |
[2025-01-18 21:57:06] |
gtaranti - Posts: 94 |
Answering my own question : To check if an attached Stop order has been moved to breakeven you can test equality of Price1 member with the parent order entry price: if (Stop1TradeOrder.Price1 == EntryPrice) StopWentToBreakeven = 1; |
[2025-01-19 18:03:20] |
Sierra_Chart Engineering - Posts: 19290 |
We can provide a proper and reliable solution to this. There is a variable we can provide access to for both Move Stop to Breakeven configurations on an order that provides the following: enum MoveToBreakEvenActionTypeEnum : int
{ MOVETO_BE_ACTION_TYPE_NONE = 0 , MOVETO_BE_ACTION_TYPE_OFFSET_TRIGGERED = 1 , MOVETO_BE_ACTION_TYPE_OCO_GROUP_TRIGGERED = 2 , MOVETO_BE_ACTION_TYPE_TRAIL_TO_BREAKEVEN = 3 , MOVETO_BE_ACTION_TYPE_OFFSET_TRIGGERED_TRAIL_TO_BREAKEVEN = 4 , MOVETO_BE_ACTION_TYPE_COUNT = 5 }; If initially, the action type is not None and then it becomes None, then you know that the action has been completed. We will add this. It is not difficult. 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, use the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2025-01-19 18:03:31
|
[2025-01-19 19:22:21] |
gtaranti - Posts: 94 |
I don't fully get it. MoveToBreakEven is a member of s_SCNewOrder. So, do we have to track the the MoveToBreakEven.Type of NewOrder after the order has been submitted? s_SCNewOrder NewOrder; NewOrder.MoveToBreakEven.Type = MOVETO_BE_ACTION_TYPE_OFFSET_TRIGGERED; NewOrder.MoveToBreakEven.TriggerOffsetInTicks = 50; .... .... // Logic to check NewOrder.MoveToBreakEven.Type in order to determine if type changed from original type to NONE. I think an additional member to the s_ACSTrade structure would be more appropriate. This is how I usually track new trades, and check their progress: s_ACSTrade TradeEntry; sc.GetTradeListEntry(sc.GetTradeListSize() - 1, TradeEntry); |
[2025-02-11 08:19:05] |
gtaranti - Posts: 94 |
Any news here?
|
To post a message in this thread, you need to log in with your Sierra Chart account: