Support Board
Date/Time: Thu, 28 Nov 2024 10:38:15 +0000
[Programming Help] - Question about exiting trading positions using ASCII
View Count: 363
[2023-05-10 12:21:20] |
User395175 - Posts: 87 |
Hi, suppose i submit 1 buy order with its target and stop attached orders at time t1(and get filled), then i submit another buy order with its target and stop attached orders at time t2(also get filled). At time t3, i have 2 unit long positions and i want to exit 1 unit long position that the first buy order created and cancel that 2 attached orders (target and stop orders, linked to my first buy order, not my second buy order), and don't touch/ modify/ cancel anything related to another 1 unit long position created by my second buy order and its target/stop attached orders. How can i achieve it using ASCII in my own study? |
[2023-05-10 22:42:49] |
ForgivingComputers.com - Posts: 960 |
You need to capture the Internal Order ID of the parent order when the order is filled. Then you use: sc.CancelOrder(InternalOrderID);
Automated Trading From an Advanced Custom Study: sc.CancelOrder |
[2023-05-11 03:15:01] |
User395175 - Posts: 87 |
I can only use this function to cancel target/stop attached orders, right? Or I can use this to close that position?
|
[2023-05-11 14:36:50] |
ForgivingComputers.com - Posts: 960 |
I can only use this function to cancel target/stop attached orders, right? Or I can use this to close that position?
You can use it to cancel any order, parent or attached. When you cancel the parent order, the attached orders will also be canceled. |
To post a message in this thread, you need to log in with your Sierra Chart account: