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

Notification

Icon
Error

Options
Go to last post Go to first unread
mariomaltezi  
#1 Posted : Thursday, February 10, 2011 6:09:23 AM(UTC)
mariomaltezi

Rank: Newbie

Groups ready for retrieval: Registered, Registered Users
Joined: 5/20/2010(UTC)
Posts: 2

Hi all,

I'm new to Metastock and i need some assistance.
I'm trying to implement an expert advisor that will have as a buy signal when at least 2 of the 3 conditions I'm using are true.
For example

CONDITION1:= Mov(C,5,E) > Mov(C,10,E);
CONDITION2:= Mov(C,5,E) > Mov(C,34,E);
CONDITION3:= Mov(C,10,E) > Mov(C,34,E);

Ideally i would say:
Counter:=0;

If (CONDITION1,Counter = Counter +1 ,0);
If (CONDITION2,Counter = Counter +1 ,0);
If (CONDITION3,Counter = Counter +1 ,0);

If (Counter > 2,1,0);

Is there a way to implement this without using If, Elseif etc???
I'm asking this because i want to use about 7 conditions and only when 4 or 5 of them are true i want to get that signal.

I will really appreciate your response.

Best Regards,

Marios
mstt  
#2 Posted : Thursday, February 10, 2011 11:51:23 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi Marios CON1:= Mov(C,5,E) > Mov(C,10,E); CON2:= Mov(C,5,E) > Mov(C,34,E); CON3:= Mov(C,10,E) > Mov(C,34,E); Sum(CON1+CON2+CON3,1)>=2; Extend the Sum() function fo include as many conditions as you like. Roy MetaStock Tips & Tools
mariomaltezi  
#3 Posted : Thursday, February 10, 2011 3:44:48 PM(UTC)
mariomaltezi

Rank: Newbie

Groups ready for retrieval: Registered, Registered Users
Joined: 5/20/2010(UTC)
Posts: 2

Hi Roy,

I guess that was the solution i was looking for.

Many thanks for your superfast response.

Marios
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.