Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 19:37:54 +0000



[User Discussion] - Alert condition with lookback over range t-n bars

View Count: 260

[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
[2023-01-17 13:26:13]
Sawtooth - Posts: 3975
This would require using the Spreadsheet System/Alert study.
You'd use one Formula Column to find the bars where the condition is TRUE.
You'd use another Formula Column to count consecutive TRUEs, where it would reset to 0 if no longer consecutive.
You'd use another Formula Columns for the alert when the count exceeded 100.
You'd be able to set the lookback length in a cell on the sheet.
Date Time Of Last Edit: 2023-01-17 20:02:51

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

Login

Login Page - Create Account