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

Notification

Icon
Error

Options
Go to last post Go to first unread
trevor_richter  
#1 Posted : Tuesday, January 24, 2006 12:54:21 AM(UTC)
trevor_richter

Rank: Newbie

Groups: Registered, Registered Users
Joined: 1/24/2006(UTC)
Posts: 3

Hi -- I am a total newbie, although I have mastered the basics of writing formulas thanks to the Formula Primer. I have a fairly simple question: How do I write a formula to calculate the average daily percent (%) decrease in the closing price for a period N, i.e. calculate the average negative daily percent price change for the period N, ignoring any positive changes (increases) in the same period. I would like to set up a buy signal for when the % change in the latest closing price versus the previous close is smaller than the average daily percent decrease in the closing price for the previous N days. Any ideas? Perhaps there is a formula/system already in existence along these lines? Thanks in advance, Trevor
Jose  
#2 Posted : Tuesday, January 24, 2006 1:28:26 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Try this: [code:1:6af4051840]Nperiods:=21; DailyChange:=ROC(C,1,%); AvgDailyCh:=Mov(DailyChange,Nperiods,S); short:=DailyChange<AvgDailyCh; long:=DailyChange>AvgDailyCh; long-short [/code:1:6af4051840] jose '-)
trevor_richter  
#3 Posted : Tuesday, January 24, 2006 4:55:22 AM(UTC)
trevor_richter

Rank: Newbie

Groups: Registered, Registered Users
Joined: 1/24/2006(UTC)
Posts: 3

Thanks for the quick reply Jose! That gets me halfway there; the problem is that I don't believe that AvgDailyCh:=Mov(DailyChange,Nperiods,S); includes only negative ROC values in the average. The price will move up and down over the period in question, but I want to exclude the upward ROC values when calculating the average... Can this be done relatively easily? Cheers, Trevor
Jose  
#4 Posted : Tuesday, January 24, 2006 10:10:19 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
trevor_richter wrote:
the problem is that I don't believe
Oh no... you must believe in MetaStock! :? Ok, try this: [code:1:fd83878679]Nperiods:=21; DailyChange:=ROC(C,1,%); UpDailyChange:=ROC(C,1,%)*(ROC(C,1,%)>0); {DownDailyChange:=ROC(C,1,%)*(ROC(C,1,%)<0);} AvgDailyUpCh:=Mov(UpDailyChange,Nperiods,S); short:=UpDailyChange<AvgDailyUpCh; long:=UpDailyChange>AvgDailyUpCh; long-short [/code:1:fd83878679] jose '-)
trevor_richter  
#5 Posted : Wednesday, January 25, 2006 3:44:56 AM(UTC)
trevor_richter

Rank: Newbie

Groups: Registered, Registered Users
Joined: 1/24/2006(UTC)
Posts: 3

ok Jose, I've settled for this... Nperiods:=21; DailyChange:=ROC(C,1,%); DownDailyChange:=ROC(C,1,%)*(ROC(C,1,%)<0); AvgDownDailyChange:=Mov(DownDailyChange,Nperiods,S); short:=DailyChange<AvgDownDailyChange; long:=DailyChange>AvgDownDailyChange; long-short Agree? Thanks for the help, Trevor
Jose  
#6 Posted : Wednesday, January 25, 2006 5:08:39 AM(UTC)
Jose

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 1/19/2005(UTC)
Posts: 1,065
Location: Koh Pha-Ngan, Earth

Was thanked: 2 time(s) in 2 post(s)
Oh, so now you want the down daily changes, eh? And to think it only took you three posts for me to catch on... :) jose '-)
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.