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

Notification

Icon
Error

Options
Go to last post Go to first unread
jmjki  
#1 Posted : Saturday, March 6, 2010 10:46:40 PM(UTC)
jmjki

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/5/2010(UTC)
Posts: 7

Can any body interpret this code.I want to learn metastock programming

For Buy Signal:-

a1:=MACD()-Mov(MACD(),9,E)>Ref(MACD()-Mov(MACD(),9,E),-1) AND Ref(MACD()-Mov(MACD(),9,E),-1)<Ref(MACD()-Mov(MACD(),9,E),-2);
a2:=MACD()-Mov(MACD(),9,E)<Ref(MACD()-Mov(MACD(),9,E),-1) AND Ref(MACD()-Mov(MACD(),9,E),-1)>Ref(MACD()-Mov(MACD(),9,E),-2);
b1:=ValueWhen(1,a1,Ref(MACD()-Mov(MACD(),9,E),-1))>ValueWhen(2,a1,Ref(MACD()-Mov(MACD(),9,E),-1)) AND ValueWhen(1,a1,C)<ValueWhen(2,a1,C);
b2:=ValueWhen(1,a2,Ref(MACD()-Mov(MACD(),9,E),-1))<ValueWhen(2,a2,Ref(MACD()-Mov(MACD(),9,E),-1)) AND ValueWhen(1,a2,C)>ValueWhen(2,a2,C);
state1:=If(BarsSince(b1)<BarsSince(b2),1,0);

a:=state1>Ref(state1,-1);
b:=state1<Ref(state1,-1);

state:=If(BarsSince(a)<BarsSince(b),1,0);

state>Ref(state,-1)




johnl  
#2 Posted : Wednesday, March 10, 2010 6:54:06 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

What I do when I want to investigate a new indicator is to plot each of it's parts one
by one.
Comment out the last line like
{state>Ref(state,-1)}
and then type in
a1;a2;
then
b1:b2
and plot in an inner window of a chart to see what each variable is doing.

Users browsing this topic
Guest (Hidden)
Similar Topics
MACD Help - How to calculate when black line is within -.01 of the zero line (Formula Assistance)
by MrJimbo 4/29/2007 3:08:40 PM(UTC)
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.