MetaStock 'P' Variable Function

Provided By www.meta-formula.com

The P variable is a special data array identifier that can be used to reference any indicator or price plot. Although it's called the `P' variable it doesn't work like a variable. It works similarly to other data array identifiers, the only difference being it's more versatile. The reason it's called a variable is because it can be changed depending on which indicator or price plot it's referencing. To select an indicator or price plot, click once on the item and small squares appear evenly spaced along the item. When selected we can now use this information by referencing the P variable. The syntax is simply `P'. Thus, by simply typing `P' in a formula, in place of other data array identifiers, we can reference our selected information. (e.g., `HHV(P,20)' and `Mov(P,10,E)' etc).

EXAMPLE

The following example was taken from MetaStock's help file:

The following custom indicator plots an "MACD-type" indicator (i.e., the difference between a 12 period and a 26 period exponential moving average) of the plot it is dropped on.

Mov( P, 12, E) - Mov( P, 26, E)

If you plot the predefined Relative Strength Index (RSI) indicator and then drop the above custom indicator on it from the QuickList, the result will be an MACD of the Relative Strength Index (RSI) indicator.

Of course, you could write the preceding formula without using the "P" identifier as shown below, but you would have to modify it if you wanted an MACD of an indicator other than the Relative Strength Index (RSI).

Mov( RSI(C,20), 12, E) - Mov(RSI(C,20), 26, E)

APPLICATION

Although there are numerous uses for the P variable, perhaps its most functional use is within an exploration. By using the P variable it becomes possible to compare securities against a selected base security. This concept forms the basis of our Relative Strength Comparison (RSC) explorer. Later, in The Explorer chapter, we'll examine this in depth (Refer to page 154).

That said, here's a bit of a teaser. Basically the P variable represents a pre-selected price plot that is chosen before the exploration is run. Then wherever we've made reference to the P variable, MetaStock will reference this selected price plot. In that way, we can use a base security by which to compare other charts. For example, we can compare market sectors against a chosen market index. We can then rank these sectors to find out which ones are performing the strongest; and from there we can identify which shares fall within these sectors.

That's the power behind the P variable and now that we've whet your appetite, we'll say no more until The Explorer chapter.

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