Reply To: HIGHESTHIGH function reference a variable for look back period

Optuma Forums Optuma Scripting HIGHESTHIGH function reference a variable for look back period Reply To: HIGHESTHIGH function reference a variable for look back period

#66162
Matthew
  • Topics: 5
  • Replies: 435
  • Posts: 440

Hi,

The following script could work, but it’s only valid for current data (ie you can’t scan for historical instances).

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.

Ex2
If you enabled training mode and started hiding bars, the Highest High line would adjust based on the $a variable count.

1 user thanked author for this post.

Pin It on Pinterest