MetaStock Peak Function

Provided By

The Peak function allows you to refer to a peak (i.e. distinct highs) in any selected `data array'. Technically speaking, a peak is the highest point reached between a short term up trend and a short term down trend. The way this function identifies a peak is based on the selected data array moving down a set percentage from a high. This percentage is set by the user. Additionally, by using the `peak' function, not only can you refer to the most recent peak but also to any peak before that.

SYNTAX Peak(Nth, Data Array, %Minimum Change)

Nth _ The number of the peak you wish to refer to. For example, N = 1 would return the value of the most recent peak in the data array, and N = 2 would return the value of the peak before that one.

Data Array _ The data array searched to identify where the peak occurred; this is normally the closing price.

% Minimum Change _ The minimum percentage required for a data array to move away from a high before it is classed as a peak.


The following formula returns the value of the closing price at the most recent point where the closing price has fallen 3% from its high.


In the formula above:

Nth = 1

Data Array = C

% Minimum Change = 3


A more useful application of this example could be:

C> Peak(1,C,3)

This formula specifies that the closing price must be greater than the value of the closing price on the most recent occasion that it moved down 3% from the high. This formula can be part of a useful entry signal since it identifies those stocks showing signs of commencing or continuing a medium term up trend.

Another useful application is to use the peak function to identify those securities achieving higher peaks and higher troughs. This could be coded using the following formula:

Peak(1,C,3)> Peak(2,C,3)

Looking at Figure 3.17 we can see the first example applied to the chart as an indicator


Figure 3.17 _ Peak


Construct the formula for the following:

1. The second most recent peak in the closing price where there was a 4% change in price:


This article is a snippet from the
MetaStock Programming Study Guide...

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

Click Here To Find For More About
The MetaStock Programming Study Guide

copyright 2007