Login Page - Create Account

Support Board


Date/Time: Sun, 12 May 2024 20:35:07 +0000



Post From: Syntax for some event happened during the last x bars?

[2017-06-06 20:34:06]
User947126 - Posts: 14
Hello,

This is not a suggestion, just a question--I'm wondering if it's possible to create a condition in an alert that specifies whether some event happened at any time during the last y bars. In other words, let's say that I want to know if the value of moving average #1 was greater than the value of moving average #2 at any point during the last five bars. The only way I know to do this is:

or(id1.sg1[-1]>id2.sg1[-1],id1.sg1[-2]>id2.sg1[-2],id1.sg1[-3]>id2.sg1[-3],id1.sg1[-4]>id2.sg1[-4],id1.sg1[-5]>id2.sg1[-5])

Is there a more economical way to do this--like some sort of way to specify a range of bars? Something like (and I'm making this up):

or(id1.sg1[-1:-5]>id2.sg1[-1:-5])?

Thanks