The first function we will look at is the Alert function. It's
used in conjunction with other functions to extend a signal for
a specified number of periods. In other words, it holds an expression
as true for as long as we wish.
think about the alert function with gates and triggers in mind.
Using this function we can hold a gate open for a specific period
while waiting for a confirming trigger. This provides a vital ingredient
to creating a fully automated system. However, before we get ahead
of ourselves, let's have a closer look at the Alert function's syntax.
That is, the way in which it's coded into MetaStock.
_ The technical condition that you are wishing to hold true. This
is usually your gate.
_ The length of time that you wish to hold the expression as true.
see this function in action. The formula below identifies stocks
that have had their volume 50% greater than the 21 period moving
average of volume. This indicates that the interest within the stock
has increased. Moreover, by using the Alert function we have extended
the period that this condition exists from one period to five. That
is to say, we have told MetaStock that for all intents and purposes
the increase in volume on the initial period would provide the same
signal for the following five periods.
above formula can be broken down as follows:
= V > mov(v,21,S)*1.5
can add to this example, showing a more useful application.
formula identifies securities that are in an uptrend (denoted by
the 5 period simple moving average being greater than the 22 period
simple moving average). Additionally, securities must exhibit a
50% increase in their average volume at least once within the previous
five periods. If we were to remove the alert function, both conditions
(i.e., `V > Mov(V,21,S)*1.5' and the `Mov(C,5,S)> Mov(C,22,S)'
would have to be true simultaneously. This may not appear useful,
however when combined with other functions (e.g. the cross function
on page 41) you realise its power.
Looking at Figure 3.2 we can see the above application
applied to the chart as an indicator.
3.2 _ Alert Indicator
note that the 5 and 22 period simple moving averages shown on the
chart above is not part of this indicator. They have simply been
placed on the chart to confirm the analysis shown by the indicator.)
these function pages there will be plenty of exercises to practice
what we've learnt. Although these can be easily skipped, they provide
a good foundation to your understanding of MetaStock. We like to
think of them as a way of gradually building up your `MetaSpeak'
vocabulary. Now it's your turn to try and construct formulas for
1. Keep the expression `Cross(RSI(14),30)'
true for 13 periods.
2. Specify that the volume must
be greater than 50000 at any time over the previous five periods.
article is a snippet from the
MetaStock Programming Study Guide...
The Simple Secret to Make Metastock Easy & Identify Profitable
copyright 2007 www.meta-formula.com