Programming codex

Getting the Most Out of MetaStock’s Highest High Value


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.

MetaStock 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.

Here’s an example of how it’s used.

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

Here’s how you would use the formula in a more useful application of this example:

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.

If you are new to MetaStock formula then this might seem complex or confusing but once you ‘get it’ you’ll understand why it’s used by so many professional traders.


Source by David Jenyns

Share on facebook
Share on google
Share on twitter
Share on linkedin
Share on pinterest
Share on whatsapp

Leave a comment

Your email address will not be published. Required fields are marked *



Recent Posts