PureBytes Links
Trading Reference Links
|
Hi,
Since so many of you asked how to implement trendlines in MetaStock,
I put together a short how to for everyone to use. This is based on
my article, so anyone who wants to know more will have to read it :-)
Please note that to keep things simple I've shown the most basic
formulae. You may want to make them more complicated if you want :-)
Ok. To implement a trendline or a channel system, one needs to know
the slope of the line, and the day it is supposed to start on.
There are two choices:
1) a horizontal line
2) a sloping line
Now, a horizontal line in MetaStock talk is just a number, i.e. a
horizontal channel system, where the boundaries of a chanel are set
at 10.25 and 15.125 would consist of the following formulae:
Enter long:
P<10.25
Close long:
P>15.125
2) A sloping line can be implemented in two ways:
a) when you know the daily (or other period's) increment value
b) when you know the angle of the line (easier to use than option a),
since you can measure the angle using the Trendline by Angle tool)
Since option a) is not very useful, we'll see how option b) looks in
MetaStock lingo:
Suppose that the boundaries of a channel are set at 10.25 and 15.125
at the beginning of a trend and that we know that the slope of the
channel is 23.234 degrees (we were smart and used
the Trendline by Angle tool to measure it)
Here are the channel system formulae:
Enter long:
P<10.25+(sin(23.234)/cos(23.234))
Close long:
P>15.125+(sin(23.234)/cos(23.234))
If you try to implement these systems, they won't work for because
you haven't set the time when they're supposed to kick in.
Here's a hack that will let you specify the day when they're supposed
to become operational:
Suppose you want to start the horizontal channel system to begin
generating signals on 1st Sep 1996
Enter Long:
P<10.25 + 0 * BarsSince( ( DayOfMonth()=1 ) AND ( Month()=9 ) AND (
+ Year()=1996 ) )
Close Long:
P>15.125 + 0 * BarsSince( ( DayOfMonth()=1 ) AND ( Month()=9 ) AND (
+ Year()=1996 ) )
The appropriate formulea for the sloping channel are as follows:
Enter long:
P<10.25+(sin(23.234)/cos(23.234)) * BarsSince( ( DayOfMonth()=1 ) AND ( Month()=9 ) AND (
+ Year()=1996 ) )
Close long:
P>15.125+(sin(23.234)/cos(23.234)) * BarsSince( ( DayOfMonth()=1 ) AND ( Month()=9 ) AND (
+ Year()=1996 ) )
I hope this explains the principles behind my channel systems. You
must remember thoug, that such a system will be working for one
security only. You will need to copy it and change parameters for a
different security.
Any comments, rants and raves are welcome!
Jacek Artymiak
----------------------------------------------------
freelance writer, translator, designer, programmer
http://www.yi.com/home/ArtymiakJacek/home.html
e-mail: jartymiak@xxxxxxx
----------------------------------------------------
|