MetaStock Highest High Value Function

Provided By

The Highest High Value function will return the highest value of the selected `data array' from a specified number of periods. For example, assume we wanted to identify the highest value of the volume from the last 10 periods. To do this we would simply code a highest high value function.

SYNTAX HHV(Data Array, Periods)

Data Array _ The highest value of this data array will be returned, from the specified number of periods.

Periods _ How many periods we wish MetaStock to refer back to when finding the highest high value of the data array.


The following formula identifies the highest value that the closing price has reached in the last 40 periods:


In the formula above:

Data Array = C

Periods = 40


A more useful application of this example could be:

C= HHV(C,40)

This formula identifies the highest closing price the security has reached in the last 40 periods. It then checks to see whether the present closing price is equal to that. In other words, we're asking MetaStock whether or not the security has just achieved a new 40 period high.

Due to the versatility of MetaStock many of the formulas we used can be re-written in other ways. For example, perhaps a better way to check whether a security has made a new 40 period high could be:


This formula will check to see if today's close is greater than the highest high value in the last 40 periods, prior to the present period (denoted by `Ref(HHV(H,40),-1)'). Please refer to the Reference function (Ref) on page 75 for an explanation of its use in this formula.

Looking at Figure 3.8, we can see this example applied to the chart.


Figure 3.8 _ Highest High Value


Construct formulas for the following:

1. Return the highest high value of the open in the last 55 periods:


2. Ensure that the present close is within 4% of the highest price in the last 30 periods:


This article is a small snippet of MetaStock Programming Study Guide...

"Discover The Simple Secret to Make Metastock Easy & Identify Profitable Trades"

Find Out More About The MetaStock Programming Study Guide Click Here.

copyright 2007