Support Board
Date/Time: Wed, 05 Nov 2025 21:45:48 +0000
[Programming Help] - How to close any open trade upon removing a custom study?
View Count: 838
| [2019-10-11 14:41:15] |
| User383849 - Posts: 23 |
|
Hi! I'm writing custom trade management study. I'm stuck on how can I close any open trade upon removing this custom study. Any help would be much appreciated. Thank you for your time :) |
| [2019-10-13 20:43:59] |
| ForgivingComputers.com - Posts: 1154 |
|
sc.LastCallToFunction ACSIL Interface Members - Variables and Arrays: sc.LastCallToFunction Date Time Of Last Edit: 2019-10-13 20:44:32
|
| [2019-10-14 19:35:57] |
| User383849 - Posts: 23 |
|
Thanks bradh! It's as simple as calling the FlattenAndCancelAllOrders() in the LastCallToFunction! |
| [2019-10-14 20:28:05] |
| ForgivingComputers.com - Posts: 1154 |
|
It's as simple as calling the FlattenAndCancelAllOrders() in the LastCallToFunction!
Almost. If there are no open positions or orders, you may get a trade service error. It should not be a problem, as there is nothing to cancel or flatten. I suppose it depends on your broker. |
To post a message in this thread, you need to log in with your Sierra Chart account:
