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

Notification

Icon
Error

Options
Go to last post Go to first unread
vikas  
#1 Posted : Saturday, February 7, 2015 4:40:13 AM(UTC)
vikas

Rank: Member

Groups: Registered Users, Subscribers
Joined: 2/7/2015(UTC)
Posts: 15

Thanks: 9 times

Hi,

I am trying to generate an alert in Expert Advisor when the following conditions are fulfilled for the 1st time:

Mov(C,3,E)>Mov(C,5,E) AND
Mov(C,5,E)>Mov(C,8,E) AND
Mov(C,8,E)>Mov(C,10,E) AND
Mov(C,10,E)>Mov(C,12,E) AND
Mov(C,12,E)>Mov(C,15,E) AND
Mov(C,15,E)>Mov(C,30,E) AND
Mov(C,30,E)>Mov(C,35,E) AND
Mov(C,35,E)>Mov(C,40,E) AND
Mov(C,40,E)>Mov(C,45,E) AND
Mov(C,45,E)>Mov(C,50,E) AND
Mov(C,50,E)>Mov(C,60,E)

I can get the candles highlighted when the conditions are fulfilled but just can't get to generate an alert when it happens for the first time.

I am a novice when it comes to Metastock or any kind of coding.

PS: The EMAs are part of Guppy system.

Thanks in advance.

 

Edited by user Saturday, February 7, 2015 4:58:13 AM(UTC)  | Reason: Not specified

MS Support  
#2 Posted : Saturday, February 7, 2015 7:12:26 AM(UTC)
MS Support

Rank: Advanced Member

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

Thanks: 94 times
Was thanked: 156 time(s) in 151 post(s)
Generally speaking no you cannot have an alert fire once then disable itself.

You can use the Cross function to identify the first time a condition becomes true (after being not true) but this won't limit the expert advisor firing off an alert with each new tick if the condition remains true. An example of using the cross function would be:


X:=Mov(C,3,E)>Mov(C,5,E) AND
Mov(C,5,E)>Mov(C,8,E) AND
Mov(C,8,E)>Mov(C,10,E) AND
Mov(C,10,E)>Mov(C,12,E) AND
Mov(C,12,E)>Mov(C,15,E) AND
Mov(C,15,E)>Mov(C,30,E) AND
Mov(C,30,E)>Mov(C,35,E) AND
Mov(C,35,E)>Mov(C,40,E) AND
Mov(C,40,E)>Mov(C,45,E) AND
Mov(C,45,E)>Mov(C,50,E) AND
Mov(C,50,E)>Mov(C,60,E);
Cross(X,0.5)
thanks 1 user thanked MS Support for this useful post.
vikas on 2/7/2015(UTC)
vikas  
#3 Posted : Saturday, February 7, 2015 3:00:07 PM(UTC)
vikas

Rank: Member

Groups: Registered Users, Subscribers
Joined: 2/7/2015(UTC)
Posts: 15

Thanks: 9 times
Originally Posted by: MS Support Go to Quoted Post
Generally speaking no you cannot have an alert fire once then disable itself.

You can use the Cross function to identify the first time a condition becomes true (after being not true) but this won't limit the expert advisor firing off an alert with each new tick if the condition remains true. An example of using the cross function would be:


X:=Mov(C,3,E)>Mov(C,5,E) AND
Mov(C,5,E)>Mov(C,8,E) AND
Mov(C,8,E)>Mov(C,10,E) AND
Mov(C,10,E)>Mov(C,12,E) AND
Mov(C,12,E)>Mov(C,15,E) AND
Mov(C,15,E)>Mov(C,30,E) AND
Mov(C,30,E)>Mov(C,35,E) AND
Mov(C,35,E)>Mov(C,40,E) AND
Mov(C,40,E)>Mov(C,45,E) AND
Mov(C,45,E)>Mov(C,50,E) AND
Mov(C,50,E)>Mov(C,60,E);

Cross(X,0.5)

This is exactly what I was looking for . Thanks a million.

Just one question. What is this '0.5'? How did you get it.

MS Support  
#4 Posted : Saturday, February 7, 2015 3:36:49 PM(UTC)
MS Support

Rank: Advanced Member

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

Thanks: 94 times
Was thanked: 156 time(s) in 151 post(s)
When a condition is not true, it is generally going to be 0 (You can use the IF statement to change the output but generally speaking 0 is your "not true" state). So basically when a condition becomes true, it changes to a value of 1. 0.5 is simply a value between 0 and 1 that the Cross function can pick up on.
vikas  
#5 Posted : Sunday, February 8, 2015 2:43:13 AM(UTC)
vikas

Rank: Member

Groups: Registered Users, Subscribers
Joined: 2/7/2015(UTC)
Posts: 15

Thanks: 9 times
Thanks a ton.
henry1224  
#6 Posted : Tuesday, February 10, 2015 12:53:32 AM(UTC)
henry1224

Rank: Advanced Member

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

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

There are 6 possible variations using 3 ma's, and 24 variations with 4 ma's, I don't think that there is enough room in the Formula builder for 12 ma's

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.