MetaStock Trough Function

Provided By

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

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

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

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

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


The following formula returns the value of the closing price at the most recent point where the closing price has risen 4% from a low.


In the formula above:

Nth = 1

Data Array = C

% Minimum Change = 4


A more useful application of this example could be:


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

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


Looking at Figure 3.20, we can see this example applied to the chart as an indicator


Figure 3.20 _ Trough


Construct formulas for the following:

1. The second most recent trough 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