Support Board
Date/Time: Sun, 19 Jan 2025 21:54:22 +0000
Post From: Referencing Previous Bars using Alert Studies
[2018-04-29 02:46:46] |
a Gem Tree - Posts: 60 |
Hello again SC. I am trying to detect, using alert code, whether a specific event happened within the last few bars. Right now, I am writing the condition to detect, bar by bar. So if I want to detect if the event has happened within the last 20 bars, I have to write: =and(ID1.SG1[-1]<X,ID1.SG1[-2]<X,etc,etc,etc) Is there a way to more easily detect for events? Something that would only require 1 line of code, or perhaps a study that does this? I know I can use spreadsheets to look for matches in an array, but that taxes my server's power too much. Any help is much appreciated. Thank you for reading! -Ben |