MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

Recursive Moving Trend Average by Dennis Meyers
Is the name of an article in the December issue of TASC, written by DennisMeyers.
In it he describes what he calls "The Recursive Moving Trend Average". I wont go into all the article right now, but here is my translationof his math (for Metastock 6.5) :

Recursive Moving Trend Average

Lb:=Input("Look-Back Period?",3,100,21);
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+C;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+ (Alpha*Abs(C+Bot-Ref(Bot,-1)));
RMTA;

He then explains how to make an oscillator by subtracting an Exponential MAform the Recursive MA...... again here is the code:

TOSC Oscillator I

Lb:=Input("Look-Back Period?",3,100,21);
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+C;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+ (Alpha*Abs(C+Bot-Ref(Bot,-1)));
TOSC:=RMTA-Mov(C,lb,E);
TOSC;

Here is the code for System Testing:

Lb:=opt1;
ent:=3;
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+C;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+(Alpha*Abs(C+Bot-Ref(Bot,-1)));
TOSC:=RMTA-Mov(C,lb,E);
Cross(tosc,(0-Abs(ent)))

Sell short:

Lb:=opt1;
ent:=3;
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+C;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,C,PREV))+(Alpha*Abs(C+Bot-Ref(Bot,-1)));
TOSC:=RMTA-Mov(C,lb,E);
Cross((0+Abs(ent)),tosc1)

Opt1 is the look- back periods, of 3 to 30, and
Opt2 is the entry value of the oscillator, 0 to 5.

Now, after all the hours spent on figuring out the code, I have discoveredthat
the RMTA plots very similar to the DEMA, oh well............
e-mail: VonHef@itlnet.net

----- Original Message -----
From: Glen Wallace <gcwallace@xxxxxxxx>
To: MetaStock listserver <metastock@xxxxxxxxxxxxxxxxxx>
Sent: Saturday, May 08, 1999 8:44 PM
Subject: Recursive Moving Trendline system

Several months ago I adapted the Recursive Moving Trendline system described in the Dec98 issue of Technical Analysis of Stocks & Commodities to a MetaStock system. I don't recall if anyone has posted the code and I have been meaning to bring it up. In any case, I would be happy to share it if anyone is interested.

The system is basically a moving average crossover system used to identify changes in trends. It compares a Recursive Moving Trendline (which attempts to predict tomorrow's price using an exponential moving average slope calculation) to an Exponential Moving Average of the price plot. A crossover of the two lines triggers a buy or sell signal. It might make a useful addition for those who use a linear regression-based system.

Overall, it seems to identify trends and trend changes quite well, though with the weak money management capabilities of MetaStock, it is difficult to fine tune the system to avoid whipsaws during retracements.

I have attached a sample DJIA chart for the period from July to December. The green line is a 10-day RMT and the red is a 10-day EMA. In theory, one buys when the green line crosses over the red, and sells when red crosses over green.

Let me know if you want to try it out. My only condition (aye, therein lies the rub) is that you share your insights and improvements -- particularly money management enhancements -- with the group.

Regards.

Re: Recursive Moving Trendline system

·To: <metastock@xxxxxxxxxxxxx>
·Subject: Re: Recursive Moving Trendline system
·From: "VonHef" <VonHef@xxxxxxxxxxxxx>
·Date: Sat, 8 May 1999 22:19:20 -0500
·Organization: Microsoft Corporation
·References: <01dd01be99bd\$b83c97c0\$5f1c4118@xxxxxxxxxxxxxxxxxxxxxx>
·Sender: owner-metastock@xxxxxxxxxxxxx

Glen,
Looks like you did some good work! I had worked on this some.....but ended-up making an oscillator out of it (subtracting the ema from the rta). If you wish to try "tuning" it in MetaStock, you could try different entry levels from the oscillator....for example go long when TOSC crosses from below -2, or Short when crosses from above +2. Anywise here is the code I came up with if you wish to compare them to each other:

TOSC Oscillator II

Lb:=Input("Look-Back Period?",3,100,21);
Ty:=Input("1=C 2=H 3=L 4= Median Price",1,4,1);
Tv:=If(Ty=1,C,If(Ty=2,H,If(Ty=3,L,MP())));
Alpha:=2/(LB+1);
Bot:=(1-Alpha)*(If(Cum(1)<Lb,Tv,PREV))+Tv;
RMTA:=(1-Alpha)*(If(Cum(1)<Lb,Tv,PREV)) + (Alpha*(Tv+Bot-Ref(Bot,-1)));
TOSC:=RMTA-Mov(Tv,lb,E);
TOSC;

NOTE: this code will work slowly because of all of the "PREV" functions.

Best wishes,
VonHef@xxxxxxxxxxxxx
Source / From: TOP