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

Notification

Icon
Error

Options
Go to last post Go to first unread
OrsonCarte  
#1 Posted : Tuesday, September 8, 2020 4:49:11 PM(UTC)
OrsonCarte

Rank: Newbie

Groups: Registered Users, Subscribers
Joined: 3/20/2016(UTC)
Posts: 6

Thanks: 2 times

Hello,

Any hardcore Metastock users still out there? Help with a slightly bizarre problem appreciated.

Using MS Explorer, I want to count the number of times that a stock closes less that $1 up or $1 down.

This does the trick:

Cum( (C < (Ref(C,-1) + 1) AND C > (Ref(C,-1) - 1)) )

.....except that closes EQUAL to the previous close are not counted.

In a separate column, this counts closes equal to the previous close no problem:

Cum(C = Ref(C,-1))

Even putting both formulas together doesn't yield the correct result:

Cum( (C < (Ref(C,-1) + 1) AND C > (Ref(C,-1) - 1)) OR C = Ref(C,-1) )

The result is the same as the first formula.

Any advice appreciated.

Best, ​​​​​​​Kevin

MS Support  
#2 Posted : Wednesday, September 9, 2020 5:45:01 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,958

Thanks: 91 times
Was thanked: 155 time(s) in 150 post(s)

Hi,

I am not sure if this is quite what you are looking for but you may want to see if this might help:

Code:
Cum(Abs(ROC(C,1,$)<=1))

The Rate of Change function looks for a $ (or %) change over X periods, either positive or negative. So we can capture the positive and negative change combined with the Absolute Value function to ensure that the 1-period $ rate of change is less than or equal to 1.

Edited by user Wednesday, September 9, 2020 5:45:46 PM(UTC)  | Reason: Not specified

OrsonCarte  
#3 Posted : Thursday, September 10, 2020 3:47:06 PM(UTC)
OrsonCarte

Rank: Newbie

Groups: Registered Users, Subscribers
Joined: 3/20/2016(UTC)
Posts: 6

Thanks: 2 times

Hello,

Many thanks for your reply, which is much appreciated.

The good news is that your suggestion does count the closes equal to the previous close. However, the count is still not correct. 

The Cum function works fine but the ROC function appears (to me) to be inconsistent. I have attached a chart for Abbott Laboratories, ABT, upon which I have plotted the ROC indicator. The indicator appears to be flagging bars erroneously, for example, 27th Mar, 26th May, 9th June.

When I modify the ROC indicator to identify closes < $2 away from the previous close, the error rate goes up substantially.

Am I doing something dumb here?

Many thanks, Kevin

P.S. I was unable to upload the image with this message. Here is a link:

https://www.dropbox.com/s/fu5dwxkkk45enaa/Abbot%20Labs%20ROC.jpg?dl=0

MS Support  
#4 Posted : Thursday, September 10, 2020 9:12:41 PM(UTC)
MS Support

Rank: Advanced Member

Groups: Moderators, Registered, Registered Users, Subscribers
Joined: 10/8/2010(UTC)
Posts: 1,958

Thanks: 91 times
Was thanked: 155 time(s) in 150 post(s)
Originally Posted by: OrsonCarte Go to Quoted Post

Hello,

Many thanks for your reply, which is much appreciated.

The good news is that your suggestion does count the closes equal to the previous close. However, the count is still not correct. 

The Cum function works fine but the ROC function appears (to me) to be inconsistent. I have attached a chart for Abbott Laboratories, ABT, upon which I have plotted the ROC indicator. The indicator appears to be flagging bars erroneously, for example, 27th Mar, 26th May, 9th June.

When I modify the ROC indicator to identify closes < $2 away from the previous close, the error rate goes up substantially.

Am I doing something dumb here?

Many thanks, Kevin

P.S. I was unable to upload the image with this message. Here is a link:

https://www.dropbox.com/s/fu5dwxkkk45enaa/Abbot%20Labs%20ROC.jpg?dl=0

Hi again and sorry about that!

You are right in that it is not behaving properly thanks to my poor use of parentheses.

Code:
Cum(Abs(ROC(C,1,$))<=1)

The above should function appropriately.

Edited by user Thursday, September 10, 2020 9:13:38 PM(UTC)  | Reason: Not specified

thanks 1 user thanked MS Support for this useful post.
OrsonCarte on 9/11/2020(UTC)
OrsonCarte  
#5 Posted : Friday, September 11, 2020 10:20:55 AM(UTC)
OrsonCarte

Rank: Newbie

Groups: Registered Users, Subscribers
Joined: 3/20/2016(UTC)
Posts: 6

Thanks: 2 times

Hello,

What's the odd parentheses between friends?

Your modification works a treat and the exploration performs perfectly. Many thanks, once again, for your help.

Best Regards, Kevin

Users browsing this topic
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.