MetaStock Trough Bars Ago Function

Provided By www.meta-formula.com

The Trough Bars Ago function returns the number of bars that have passed since a specified trough occurred. This function is based on the Trough function. Technically speaking, a trough is the lowest point reached between a short term down trend and a short term up trend. The identification of a trough using this function however, is based on the selected data array moving up a set percentage from its most recent low.

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

Nth _ The number of the trough you wish to use as the reference point when counting how many bars have passed since then. For example, N = 1 would count the number of bars back to the most recent trough in the data array, and N = 2 would count the number of bars back to the second most recent trough.

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.

EXAMPLE

The following formula returns the number of bars that have passed since the most recent occurrence of the closing price having risen 3.5% from its low.

TroughBars(1,C,3.5)

In the formula above:

Nth = 1

Data Array = C

% Minimum Change = 3.5

APPLICATION

A more useful application of this example could be:

TroughBars(1,C,3.5)<5

This formula will count the number of bars that have passed since the most recent occasion that the closing price moved up 3.5% from the low. Additionally, it also checks whether this value is less than 5. This identifies securities that have recently created a trough and begun to move upward. 

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

 
 

Figure 3.21 _ Trough Bars Ago

EXERCISES

Construct formulas for the following:

1. Return the number of bars that have passed since the most recent time that there was a trough in the closing price where there was a 3% 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 www.meta-formula.com