Download MetaStock® Professional

Transcript
As you've probably noticed, this syntax is very similar to the syntax used
to enter formulas in spreadsheets.
All functions must be followed by a pair of parentheses. If an opening
parenthesis is not the first character after a function name, an error
message will be displayed.
Function Parameters
Parameters provide a function the necessary information required to
calculate. For example, the sqrt() function requires a single "parameter"
within the parentheses. Other functions, such as macd(), do not require
any parameters. Others, like the Volume Oscillator require four
parameters.
The following formula calculates a 14-period Money Flow Index. The
actual parameters are in bold in the following examples.
mfi(14)
Some functions require multiple parameters within the parentheses. For
example, the moving average function (shown below) requires three
parameters.
mov(rsi(14),30,simple)
In the above formula, the parameters instruct MetaStock Pro to calculate
a 30-period simple moving average of a 14-period RSI. Note that
another function (i.e., rsi(14) ) serves as one of the parameters.
If you forget to insert the proper parameter, MetaStock Pro will display a
window reminding you of the expected parameter.
Locating Errors in Formulas
MetaStock Pro does an excellent job of reporting errors in formulas. In
fact, it is impossible to enter an invalid formula. This doesn't mean your
formulas will always work as you expect them to, because MetaStock Pro
does not know what you are trying to create. However, it does mean that
the syntax of the formula (e.g., function names, parameters, operators,
parentheses, etc.) will always be valid.
When you enter a formula, MetaStock Pro tests the formula's syntax. If
an error is found, the formula will be redisplayed, the cursor will be
positioned at the error location, and a message explaining the error will
be displayed.
The effect of this error-reporting technique is that MetaStock Pro helps
you enter valid formulas. This is illustrated in the following example.
Suppose you want to plot a formula containing a 10-period exponential
moving average of the closing price and all you can remember is that the
moving average function is "mov" (see page 305 if you don't remember a
function name).
238 • The MetaStock Formula Language
MetaStock Professional