Optuma Forums › Optuma Scripting › HIGHESTHIGH function reference a variable for look back period › Reply To: HIGHESTHIGH function reference a variable for look back period
- Topics: 5
- Replies: 435
- Posts: 440
The following script could work, but it’s only valid for current data (ie you can’t scan for historical instances).
V1 = LOW() CrossesBelow LOWESTLOW(BACKTYPE=Weeks, BARS=13);
$a = TIMESINCESIGNAL(V1);
In this example, V1 looks for the new 13 Week Low being set. $a looks for the number of bars since the new low was set, and the Highest High function references this count and sets the back bars accordingly.
In the image below you can see on ASX the last 13 week low was 144 bars ago. The Highest High (blue) line is using a lookback period of 144 bars.
If you enabled training mode and started hiding bars, the Highest High line would adjust based on the $a variable count.