# MetaStock Highest Bars Ago Function

Provided By www.meta-formula.com

The Highest Bars Ago function returns the number of periods that have passed since the highest value within the selected `data array.' It's important to note that this includes the entire data loaded into the chart. For example, assume you have six years of history loaded in your chart. If you were to code the highest bars ago function with the data array set to the close, Metastock will search through the whole six years for the highest closing value. It will then count the number of periods since this occurred and return this value.

SYNTAX HighestBars(Data Array)

Data Array _ The highest value of this data array will be found in the chart.

EXAMPLE

The following formula identifies the number of periods that have occurred since the highest value of the close was recorded. This is the highest value taken from the entire loaded history of the chart:

HighestBars(C)

In the formula above:
Data Array = C

APPLICATION

A more useful application of this example could be:

HighestBars(C)<40

This formula identifies the number of bars that have passed since the highest closing price of the security was recorded. Metastock then checks whether or not this number is less than 40 (denoted by `<40'). This formula would be useful if we wanted to check whether a security's all time highest closing price had occurred recently.

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

Figure 3.7 _ Highest Bars

EXERCISES

Construct formulas for the following:

1. Return the number of periods since the security reached its all time highest value:

__________________________________________________

2. Return the number of periods since the security reached its all time highest closing price:

__________________________________________________