Support Board
Date/Time: Sun, 19 Jan 2025 17:38:13 +0000
Post From: TRAILING STOP TRIGGER Help
[2018-04-14 16:03:37] |
User28317 - Posts: 149 |
I have been trying to set up a trailing stop for 3 months. When the first contract target is filled, the trailing stop is triggered. Code snippet: order.Target2Price = target02_; order.Stop2Price = stop02_; order.OCOGroup2Quantity = amount02_; order.AttachedOrderTarget2Type = SCT_ORDERTYPE_LIMIT; order.AttachedOrderStop2Type = SCT_ORDERTYPE_STOP; order.Target1Price = target01_; order.Stop1Price = stop01_; order.OCOGroup1Quantity = amount01_; order.TriggeredTrailStopTrailPriceOffset = trailingDistance_; order.TriggeredTrailStopTriggerPriceOffset = absoluteTriggerValue_ - stop01_; order.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT; order.AttachedOrderStop1Type = SCT_ORDERTYPE_TRIGGERED_TRAILING_STOP_3_OFFSETS; order.OrderQuantity = amount01_ + amount02_; if (sc.BuyEntry(order) < 0) sc.AddMessageToLog("Failed to submit order to the trading service.", 0); We need to place an order with a specific formulation. We supply the following data: e - entry for the order as absolute value in points t1 - Target for the first order as absolute value in points t2 - Target for the attached order as absolute value in points s1 - stop for the first order as absolute value in points s2 - stop for the attached order as absolute value in points l - Trigger value to start trailing as absolute value in points d - trailing distance in points n - amount of contracts for the first order k - amount of contracts for the attached order We need to place an OCO with entry e, Target as Limit at t1, stop at s1. We need to add an attached order with target as limit at t2, stop at s2, and which triggers a trailing at l with distance d. We place n contracts in the order and k contracts in the attached order. What is the correct way to submit this order to Sierra Chart in an Automatic trading study? |