Login Page - Create Account

Support Board


Date/Time: Sun, 24 Nov 2024 23:52:11 +0000



[Programming Help] - Indicator Dynamic Lookback Period

View Count: 287

[2024-04-13 17:34:15]
PS - Posts: 40
Hello,

I'd like to have an existing indicators' lookback period change based on certain conditions. For example, I want to plot the linear regressive slope indicator, but have its period vary.

I want to write a separate indicator that marks swing highs and swing lows. I then want the linear regressive slope indicators lookback to start from the most recent swing high / low and go til the current bar.

How might I go about this?

TIA for your gracious assistance.
[2024-04-16 15:49:03]
ForgivingComputers.com - Posts: 960
The Linear Regressive Slope study uses only the length and what it is based on (OHLC, etc). The length could be modified programmatically, however I am not sure how that applies to the previous swing high and swing low.

Are you saying the length is equal to the number of bars since the further of the latest swing high and the swing low?

For example:
1. Swing High at Bar 150
2. Swing Low at Bar 175
3. Current Bar is 200

Period for LR Slope = Max(200-150, 200-175) = 50

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

Login

Login Page - Create Account