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

Notification

Icon
Error

Options
Go to last post Go to first unread
DaBassman  
#1 Posted : Monday, July 7, 2008 9:32:58 AM(UTC)
DaBassman

Rank: Newbie

Groups: Registered, Registered Users
Joined: 7/7/2008(UTC)
Posts: 4

I am using the following code to identify securities in which 2
shorter term moving averages are above a longer term moving average:

Col A MOV-8: mov(c,8,e)
Col B MOV-13: mov(c,13,e)
Col C MOV-21: mov(c,21,e)

Filter:
colA>colB AND colB>colC


The above code DOES give me a list of ALL securities which meet that
criteria (including columns with the various moving averages
printed) but I was attempting to include code which will identify
these securities WHEN they first meet that criteria (a crossover).
Any suggestions on how I would program this into the above formula
would be appreciated. Peace!

Charles
Justin  
#2 Posted : Monday, July 7, 2008 11:32:56 AM(UTC)
Justin

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 9/13/2004(UTC)
Posts: 673
Location: Salt Lake City, UT

The problem is that you have 2 criteria, X > Y AND Y > Z. It is unlikely that both would be crossing at the same time. You could do a cross and a greater than to loosen the criteria up, or you could "extend" the crossover time frame (allowing the cross to have occurred within a few days) using the Alert function.

For example (Substitute the variables with your formulas)

{Very Restrictive}
Cross(X,Y) AND Cross(Y,Z)

{Less Restrictive}
(Cross(X,Y) AND Y > Z) OR (X > Y AND Cross(Y,Z))

{Looking for the Crossovers over a 3 day timeframe}

Alert(Cross(X,Y),3) AND Alert(Cross(Y,Z),3)


Also, keep in mind that you cannot use functions with Column References, i.e. Cross(ColA,ColB) so you would need to rewrite the formulas in their long form in the Filter tab.
henry1224  
#3 Posted : Monday, July 7, 2008 5:25:26 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)

there can only be 6 scenarios of the 3 MA's

123;213;231;

321;312;132;

of these 6 combinations 123 is very bullish,321 is very bearish,213 is still bullish,312 is still bearish,231 is neutral as is 132

now create an indicator rating the scenarios from +3 to -3 ie; 123=+3, 321=-3, 213=+2,

312=-2,231=+1,132=-1 and all else=0

wabbit  
#4 Posted : Monday, July 7, 2008 6:32:50 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Just to add some more ideas to the mix....

If you are looking for a particular condition, but want to find the most recent time the first instance the condition is true, by using an exploration:

Code:

{Col A MOV-8}
mov(c,8,e)

{Col B MOV-13}
mov(c,13,e)

{Col C MOV-21}
mov(c,21,e)

{Filter}
ma1:=mov(c,8,e);

ma2:=mov(c,13,e);

ma3:=mov(c,21,e);



cond:=ma1>ma2 and ma2>ma3;

cond and Alert(cond=0,2);


The above exploration will find equities meeting the criteria on the most recent bar and this may not be that useful, so we can change it around slightly:

Code:

{Col A When}
ma1:=mov(c,8,e);
ma2:=mov(c,13,e);
ma3:=mov(c,21,e);

cond:=ma1>ma2 and ma2>ma3;
barssince(cond and Alert(cond=0,2));

{Filter}
ColA>=0;


You can sort by ColA by clicking on the column header in the report to see the mopst recent events first.

And by combining these two together, you can end up with an exploration where the condition is true and also get to find out when it became true:

Code:


{Col A When}

ma1:=mov(c,8,e);

ma2:=mov(c,13,e);

ma3:=mov(c,21,e);



cond:=ma1>ma2 and ma2>ma3;

barssince(cond and Alert(cond=0,2));



{Filter}

ma1:=mov(c,8,e);

ma2:=mov(c,13,e);

ma3:=mov(c,21,e);



cond:=ma1>ma2 and ma2>ma3;

cond and ColA>=0;



Hope this helps.

wabbit [:D]

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.