Login Page - Create Account

Support Board


Date/Time: Thu, 02 May 2024 17:30:49 +0000



Post From: Alert condition with lookback over range t-n bars

[2023-01-17 09:14:02]
User843179 - Posts: 7
Hello

I am trying to make an alert that does the following:

- on a 1 trade bar chart
- measure ask volume - bid volume (bar delta)
- set a lower and upper boundary for the bar delta range of interest. for example, the bar delta range of interest might be +1 to +20.
- lookback over past n-bars to measure if the bar delta falls within the range +1 to +20
- set a hurdle for number of bars in lookback that meet condition successfully. for example, the lookback hurdle might be the past 100 bars.

The result of above logic would be an alert that triggers only when the past 100 bars all have a positive delta of size >1 and <20.

I can imagine creating it something like:

=and(id6.sg1>0,id6.sg1<20,id6.sg1>0[-1],id6.sg1[-1]<20,id6.sg1>0[-2],id6.sg1[-2]<20,etc)

However this seems awfully inefficient. I would like to have a simple logic operation that captures the lookback period without need for the repetition in my draft above.

Appreciate any help any SC staff or users can offer.

Thanks