Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 21:47:35 +0000



[Programming Help] - How to close any open trade upon removing a custom study?

View Count: 654

[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]
bradh - Posts: 853
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]
bradh - Posts: 853
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:

Login

Login Page - Create Account