Login Page - Create Account

Support Board


Date/Time: Thu, 18 Apr 2024 19:55:52 +0000



[Programming Help] - ACSIL Last 100 bars

View Count: 1256

[2018-01-21 22:48:26]
User439067 - Posts: 48
I wrote a study that detects a certain pattern using auto-looping. I wanted to limit the results it gives me to the last n bars given by the user in an input. It's super interesting to see all the instances of it but I wanted to limit it to the current situation. Specifically planning on writing an alert to detect symbols currently exhibiting this pattern while using the scanner.

What would be the best way to approach this? I've tried keeping track of the arraysize and counting, but it all seems to count left to right. I've successfully limited it to the "first 100" bars but writing it backwards just gave me everything again. All in all confused about arraysize and what SC variable hold the total amount of bars before processing. An example on how to limit the if statement to the last 100 bars would be super helpful. If you could do it on the alert side of things too like limiting it to last n bars would be fine too.

Thanks,
[2018-01-21 23:15:57]
Sierra Chart Engineering - Posts: 104368
You simply use a statement like this:
if (sc.Index < sc.ArraySize - 100)
return;

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
[2018-01-22 04:03:21]
User439067 - Posts: 48
Thank you, this is what worked for me. I appreciate the help.

if (bSwingLow && sc.Index > sc.ArraySize - barNumber)

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

Login

Login Page - Create Account