Login Page - Create Account

Support Board


Date/Time: Fri, 29 Mar 2024 15:05:42 +0000



Position older than a number of bars in ACSIL

View Count: 542

[2020-02-10 18:36:13]
sugart - Posts: 25
How do we incorporate in ACSIL code the condition to sell or cover a position if it is older than a number of bars?
Is there any relevant ACSIL example?

Thanks.
[2020-02-11 05:59:14]
Sierra Chart Engineering - Posts: 104368
Basically you would remember in a persistent variable the bar index where the Trade Position was entered:
sc.GetPersistentInt()
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
[2020-02-11 06:11:37]
sugart - Posts: 25
What about my second query? Do you have any relevant examples in your documentation?
[2020-02-11 19:38:48]
Sierra Chart Engineering - Posts: 104368
So what you would do is calculate the difference between the latest bar index, which can be determined with sc.ArraySize -1, and the saved bar index and use one of these functions once the difference exceeds a specified amount:
Automated Trading From an Advanced Custom Study: Cancel Orders and Flatten Position Functions
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
Date Time Of Last Edit: 2020-02-11 19:38:57

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account