Login Page - Create Account

Support Board


Date/Time: Wed, 01 May 2024 22:30:13 +0000



Post From: ACSIL Last 100 bars

[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,