Select Page

# VHF Script

Optuma Forums Optuma Scripting VHF Script

Viewing 2 posts - 1 through 2 (of 2 total)
• Author
Posts
• #66415
Deepak
• Topics: 69
• Replies: 59
• Posts: 128

I am trying to calculate the Vertical Horizontal Filter:

Select the number of periods (n) to include in the indicator. This should be based on the length of the cycle that you are analyzing. The most popular is 28 days (for intermediate cycles).
1. Determine the highest closing price (HCP) in n periods.
2. Determine the lowest closing price (LCP) in n periods.
3. Calculate the range of closing prices in n periods:
HCP – LCP
4. Next, calculate the movement in closing price for each period:
Closing price [today] – Closing price [yesterday]
5. Add up all price movements for n periods, disregarding whether they are up or down:
Sum of absolute values of ( Close [today] – Close [yesterday] ) for n periods
6. Divide Step 4 by Step 6:
VHF = (HCP – LCP) / (Sum of absolute values for n periods)

Below is the script i am using but in step 5 can u please help. V4 is not giving desired output

#66431
Matthew
• Topics: 5
• Replies: 487
• Posts: 492

Hi,

Try the following script:

###### 1 user thanked author for this post.
Viewing 2 posts - 1 through 2 (of 2 total)
• You must be logged in to reply to this topic.