MetaStock Cross Function

Provided By www.meta-formula.com

The Cross function identifies when one data array crosses above another data array. Similarly, when used in reverse, it shows when one data array crosses below another. Since this function's parameters can be set to any data array, it can be quite versatile in identifying anything from a moving average crossover to an RSI crossover.

SYNTAX Cross(Data Array1, Data Array2)

Data Array 1 _ is the information that is required to cross above the second set of information.

Data Array 2 _ is the information that `data array 1' crosses above.

EXAMPLE

The following formula identifies when an 8 period simple moving average crosses above a 21 period simple moving average:

Cross(Mov(C,8,S),Mov(C,21,S))

In the formula above:

Data Array 1 = Mov(C,8,S)

Data Array 2 = Mov(C,21,S)

Now imagine we wanted to identify when the 8 period simple moving average crosses below the 21 period simple moving average (which is the same as saying the 21 period simple moving average crossing above the 8 period simple moving average). We would simply swap the data arrays around.

Cross(Mov(C,21,S),Mov(C,8,S))

APPLICATION

Here's a more complex and practical application applying the alert function and two cross functions at once:

Cross(RSI(14),30) AND

Alert(Cross(Mov(C,8,S),Mov(C,21,S)), 5)

This formula specifies that the RSI must cross above the oversold area (e.g. cross above the 30 line, denoted by `Cross(RSI(14),30)'). Additionally, the 8 period simple moving average must have crossed above a 21 period simple moving average at least once within the previous five periods. By using the alert function both crosses don't necessarily have to occur simultaneously.

EXERCISES

Construct formulas for the following:

1. The closing price crossing above the 30 period simple moving average:

__________________________________________________

2. The 7 period simple moving average crossing below the 21 period simple moving average:

__________________________________________________

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