Support Board
Date/Time: Sat, 01 Feb 2025 06:52:19 +0000
(ACSIL) How do I trigger a subgraph when exiting a trade from an attached order?
View Count: 690
[2019-06-21 01:28:43] |
Tom Hanks - Posts: 20 |
Triggering a subgraph to indicate where you entered a position is straight forward, but I'm not sure what the best way to achieve this is for exiting when using attached orders. My guess is to do a check like this on every bar: sc.GetOrderByOrderID for all attached stop and target orders (order ids saved with persistent variables) and then use s_SCTradeOrder::OrderStatusCode to check if the orders are SCT_OSC_FILLED. If one of my exit orders = SCT_OSC_FILLED then draw a subgraph indicating an exit as I would on entry orders. Would this be the best way or is there something easier? Thanks!! |
[2019-06-21 15:23:15] |
ForgivingComputers.com - Posts: 992 |
After you determine it is filled set the subgraph to the AvgFillPrice of the trade order.
|
[2019-06-21 15:40:36] |
Sierra Chart Engineering - Posts: 104368 |
We think the better way to do this, is to get the most recent fills with this function: Automated Trading From an Advanced Custom Study: sc.GetOrderFillEntry() And then looking to see if the previously saved Internal Order IDs have filled. Just specify the highest available fill index when getting the fills. 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 |
To post a message in this thread, you need to log in with your Sierra Chart account: