Login Page - Create Account

Support Board

Date/Time: Tue, 23 Apr 2024 01:20:34 +0000

[Programming Help] - Find number of bars since a condition is true.

View Count: 294

[2023-01-25 15:22:22]
User538264 - Posts: 16
Is there a function in ACSIL through which I can find the number of bars since a condition is true.
For example, let's say I want to find out how many bars did the first moving average crossover occurred. and how many bars ago did the second crossover occurred?

[2023-01-30 20:37:54]
User183724 - Posts: 183
i don't know of a pre built function to do this but it would be pretty simple to write your own function. you would need to store the index of the bar of the first crossover in a presistent (probably) variable and subtract that variable from index number of the bar of the second crossover to calculate the number of bars in between... if i am understanding what your're wanting...
Date Time Of Last Edit: 2023-01-30 20:40:08
[2023-01-31 10:15:38]
User538264 - Posts: 16
I got it working already. Thanks.

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


Login Page - Create Account