logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
yonah1  
#1 Posted : Sunday, December 30, 2007 9:15:35 PM(UTC)
yonah1

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/15/2007(UTC)
Posts: 14

I have just coded Jeff Cooper's "5 Day momentum method". This is my second attempt to develope code for MetaStock. I would appreciate anyone taking a look at my code. Suggest inprovements or point out any errors that you see.

Here are the rules:

Buy Rules:

Only trade stock whose ADX is 35 or greater.

+DI > -DI

8 period Fast %k <= 40

Close > 50

Sell Rules:

Only trade stock whose ADX is 35 or greater.

+DI < -DI

8 period Fast %k >= 60

Close > 40

My buy code:

PDI(14)>MDI(14) AND
Stoch(8,1)<=40
AND
CLOSE > 50
AND
ADX(14)>35
AND
Mov(V,90,S)> 50000 {I added Volume to screen out trash}

My Sell code:

PDI(14)<MDI(14)
AND
Stoch(8,1)>=60
AND
CLOSE > 40
AND
ADX(14)>35
AND
Mov(V,90,S)> 50000 {I added Volume to screen out trash}

Thanks

pumrysh  
#2 Posted : Monday, December 31, 2007 11:13:04 AM(UTC)
pumrysh

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/28/2004(UTC)
Posts: 110

I don't have the rules in front of me but I would think that the argument would be for the close to be greater than its 50 day moving average and not a value of 50. If that is the case then you would need to change CLOSE > 50 to CLOSE > Mov(C,50,S) for the Buy side code. Same adjustment would need to be made on the Sell side. I would also move the ADX(14)>35 argument to the beginning of the group since it is a major determining factor in the decision process.

While the ADX is a major part of the Cooper method I would really very strongly reconsider its use. There is an inherent flaw in the indicator that renders it useless for trend identification until it has exceeded a value of 30 or above. That's usually pretty slow and puts you into a momentum trade very late.

Close > 40 looks suspicious to me as well. Recheck to make sure the code is not supposed to be Close < 40 or Close < Mov(C,40,S) .

Hope this helps,

Preston


yonah1  
#3 Posted : Monday, December 31, 2007 4:46:34 PM(UTC)
yonah1

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/15/2007(UTC)
Posts: 14

Thanks Preston for your reply. The above rules are as stated in Cooper's 1997 '5 day momentum' publication.

I will move the ADX to the top. I did not know it made any difference as long as the argument was written correctly.

Thanks again!

amory  
#4 Posted : Monday, December 31, 2007 8:04:03 PM(UTC)
amory

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/18/2007(UTC)
Posts: 99
Location: sydney australia

I always thought that the ADX plays a subsidiary role to the + and - DI, and that these latter are much more indicative of what's about to happen.

when one of them crosses upwards thru the other, preferably getting itself above the 32-line within the same or the next day, you've usually got the perfect buy or sell signal, whichever. contrary to most methods, there are no downbreaks involved. it's always

DI+ up thru DI- (and hopefully getting above 32 fast) for the buy, or

DI- up thru DI+ (and likewise) for the sell.

the ADX comes into it too, but makes it too involved getting into here. would welcome further discussion when post new year head clears.

amory  
#5 Posted : Tuesday, January 1, 2008 4:24:04 PM(UTC)
amory

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/18/2007(UTC)
Posts: 99
Location: sydney australia

back to the ADX then. this one as I understand it, indicates not so much the trend (plus or minus, whichever is predominant at the time) but merely the strength of it. for instance, if the trend is positive & the ADX is coasting happily along >40, you want to watch out for any downturn because that could indicate the end of the trend. same in a fierce downward-trend, there again you'll get a high ADX reading until it downturns indicating imminent end of minus-DI run.

the ADX obeys no master. it'll work the same for plus or minus. supposed to anyway.

in that context, Yonah's formula "Only trade stock whose ADX is 35 or greater" makes sense. except I'm not sure it's a sufficiently important criteria. as Pumrysh says: "There is an inherent flaw in the indicator that renders it useless for trend identification until it has exceeded a value of 30 or above. That's usually pretty slow and puts you into a momentum trade very late".

that's for sure.

amory  
#6 Posted : Tuesday, January 1, 2008 4:55:11 PM(UTC)
amory

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 4/18/2007(UTC)
Posts: 99
Location: sydney australia

have been looking at a few charts incorporating both ADX and the DI plus & minus. come to the conclusion that the best results are achieved when the ADX upbreak to the level required by Cooper's formula takes place within a very few days of the DI upbreak >30.

still haven't tried that formula, might turn it into an exploration tonite.

pumrysh  
#7 Posted : Wednesday, January 2, 2008 1:00:28 PM(UTC)
pumrysh

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/28/2004(UTC)
Posts: 110

yonah,

Went back and reviewed your code and the Cooper rules. Cooper looks for stocks trading between $40 and $50, therefore you will want to change the your code to reflect this. He also looks for opportunities to enter a momentum trade. His exits are within 5 days of the entry.

While I have already mentioned my feelings about the ADX another potential problem that I noticed was with the Stoch. You will want to make sure that it is less than 40 and rising rather than just below 40.

Here is how I would change the code:

PDI(14)>MDI(14) AND
Stoch(8,1)<=40 AND Stoch(8,1) > REF(Stoch(8,1),-1
AND
CLOSE >= 40 AND CLOSE <= 50
AND
ADX(14)>35
AND
Mov(V,90,S)> 50000

There are a few other conditions that you may want to consider changing. Best advice that I can give you is to plot the indicators on a chart and see what you think

Best of luck,

Preston

yonah1  
#8 Posted : Wednesday, January 2, 2008 9:06:56 PM(UTC)
yonah1

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/15/2007(UTC)
Posts: 14

Thanks again Preston. I wanted to look for stoch turning up, just had not figured out how.

On price Cooper states "Price is critical! The higher the price the better." He looks for longs above $50 and shorts above $40.

Appreciate all your comments.

yonah1  
#9 Posted : Friday, January 4, 2008 3:43:52 PM(UTC)
yonah1

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/15/2007(UTC)
Posts: 14

Hi Anory,

I have noticed that you seem to get better results if you can find a security where +DI has JUST crossed above -DI and ADX >35. Here is my present code for a buy:

ADX(14)>35 AND
PDI(14)>MDI(14) AND
Stoch(8,1)<=40 AND Stoch(8,1) > Ref(Stoch(8,1),-1) AND
CLOSE > 50 AND
Mov(V,90,S)> 50000

I have tried to code for +DI crossing above -DI within the last 3 days, but have not figured it out yet. Can you help me?

Thanks,

Y

oztrader  
#10 Posted : Saturday, January 5, 2008 1:17:07 AM(UTC)
oztrader

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Hi Yonah,

Hopefully Amory won't be too concerned if I answer your question as it has been some 10 hours since your post!

BarsSince(Cross(PDI(14),MDI(14)))<4;

This code has the potential to trigger on days 0,1,2 and 3 depending on the other conditions of your system being met.

Cheers

oztrader

yonah1  
#11 Posted : Saturday, January 5, 2008 10:36:50 PM(UTC)
yonah1

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 4/15/2007(UTC)
Posts: 14

Thanks oztrader. that is exactly what I needed!! It is really simple once I see the code. I had looked at BarsSince but just was not bright enough to figure it out. [:$]

Maybe you can help me on another code not related to this one? I am new to the forum and metastock. If I should not ask in this thread let me know. I am trying to read everything I can, but still am trying to "earn as I learn." [:D]

For the month of January 2008 only, I would like to check to see if the daily High or Low is higher or lower than the monthly high or low for the month of December 2007.

I would also like to scan on Fridays after market close, checking if the January 2008 weekly High or Low is higher or lower than the monthly high or low for the month of December 2007.

The method to my madness? For some commodities the breaking of December's high or low in January can signal new price trends in the market.

Thanks,

Y

oztrader  
#12 Posted : Sunday, January 6, 2008 5:48:27 PM(UTC)
oztrader

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 7/12/2007(UTC)
Posts: 134
Location: Perth Western Australia

Hi Yonah,

Have you downloaded the MetaStock Fomula Primer pdf?

If not you can find it on this forum in the "Files" section (2 accross from Discussions).

I have sent you a PM re commodities.

Cheers,

ozt

Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.