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

Notification

Icon
Error

Options
Go to last post Go to first unread
masterfund  
#1 Posted : Wednesday, October 5, 2011 1:15:55 AM(UTC)
masterfund

Rank: Newbie

Groups: Registered, Registered Users, Subscribers
Joined: 10/5/2011(UTC)
Posts: 1

Hi Guys,

New to Metastock and metastock coding.

I'm wondering if any one knows how to code the following;

1. The most recent end of day close is less than yesterday, and yesterday is less than the day before that
2. The price close is greater than 50% of the 12 month range

Appreciate if any can help

Ch
eers
jjstein  
#2 Posted : Wednesday, October 5, 2011 12:20:02 PM(UTC)
jjstein

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/13/2005(UTC)
Posts: 715
Location: Midwest, USA

Was thanked: 1 time(s) in 1 post(s)
Since you're new, be sure to have a look at the Metastock Formula Primer.

It can sometimes be helpful to plot the condition you're describing; if you create a custom indicator and plot it in the same window as the security, you can SEE when the close is above the range:

{_My Indicator}
RangeLow:=LLV(C,252);
RangeHigh:=HHV(C,252);
Range:=RangeHigh-RangeLow;
RangeLow+Range/2;


The code as you defined it is BINARY, so you may want to plot it either in a separate window, or use the "Overlay without scale" option.

1. C<ref(C,-1) and ref(C,-1)<ref(C,-2); { Binary }


2A. This can be done simply:

C>LLV(C,252)+(HHV(C,252)-LLV(C,252))/2; { Binary }


2B. A more readable version (same as 2A. above):

RangeLow:=LLV(C,252);
RangeHigh:=HHV(C,252);
Range:=RangeHigh-RangeLow;
C>RangeLow+Range/2;


If you were planning on combining 1. and 2., a simple version would be:

C<Ref(C,-1) AND Ref(C,-1)<Ref(C,-2)
AND
C>LLV(C,252)+(HHV(C,252)-LLV(C,252))/2


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.