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

Notification

Icon
Error

Options
Go to last post Go to first unread
Cherian  
#1 Posted : Thursday, November 8, 2012 7:14:23 AM(UTC)
Cherian

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/8/2012(UTC)
Posts: 7

I am having multiple alerts when using RT. I have turned off recalculate live. How can I set an alert so that i gives me an alert only the first time the condition defined for the alert is met and not for the subsequent ones until there is a change of trend. Thanks...
henry1224  
#2 Posted : Thursday, November 8, 2012 7:20:05 AM(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)
Please post your code!

We can't help until we can see what you are trying to accomplish.


Cherian  
#3 Posted : Thursday, November 8, 2012 7:28:28 AM(UTC)
Cherian

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/8/2012(UTC)
Posts: 7

a:=Fml( "SwingTrd 2"); b:=Fml( "SwingTrd 3"); d:=Cross(a,b); f:=Cross(b,a); H>ValueWhen(1,d,H) AND BarsSince(d)
henry1224  
#4 Posted : Thursday, November 8, 2012 8:17:24 AM(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)
Looking at your code, you have an incomplete trigger signal!

Your code will trigger every time the H is greater than the trigger value

Your use of BarsSince(d) is incomplete

A simple way is to define a long entry and short entry signal, then use the if() function to create a system

If(Long,1,If(Short,-1,0));

In a Long position the indicator will plot 1 in a short position , it will plot -1 else it will plot a 0

now when the indicator plots a 1 and the Ref(indicator,-1) doesn't equal 1 is your entry signal
when the indicator plots a 0 or -1 and Ref(indicator,-1) equals 1 is your long exit signal
when the indicator plots a -1 and Ref(Indicator,-1) doesn't equal -1 is your short entry signal
when the indicator plots a 0 or 1 and Ref(Indicator,-1)equals -1 is your short exit signal
Cherian  
#5 Posted : Thursday, November 8, 2012 8:35:44 AM(UTC)
Cherian

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/8/2012(UTC)
Posts: 7

a:=Fml( "SwingTrd 2"); b:=Fml( "SwingTrd 3"); d:=Cross(a,b); f:=Cross(b,a); H>ValueWhen(1,d,H) AND BarsSince(d) less than Barssince(f) (having problems with the less than symbol here) This is the complete code.i think there was a copy paste error. anyways, so when the condition is met, i only want the first occurence alert to be sounded. but every time H is greater, the alerts keep popping up on the screen. let me know how this can be programmed into the expert advisor. Thanks, Cherian
henry1224  
#6 Posted : Thursday, November 8, 2012 11:34:25 AM(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)
I took the liberty of creating a system both long and short, Since I don't have the code for swing trend2 or 3, I can't verify the results!

here is your code

Code:


 
 
 


a:=Fml( "SwingTrd 2"); 

b:=Fml( "SwingTrd 3"); 

d:=Cross(a,b); 

f:=Cross(b,a); 

Long:=H>ValueWhen(1,d,H) AND BarsSince(d) < Barssince(f);

Short:=L<ValueWhen(1,f,L) AND BarsSince(f) <
Barssince(d);

Signal:= If(Long,1,If(Short,-1,0));

{Make the last line of code whatever signal you want}

{LongEntry} Signal=1 and Ref(Signal,-1)<>1

{LongExit} Signal<>1 and Ref(Signal,-1)=1

{ShortExit} Signal=-1 and Ref(Signal,-1)<>-1

{ShortExit} Signal<>-1 and Ref(Signal,-1)=-1
henry1224  
#7 Posted : Thursday, November 8, 2012 11:45:57 AM(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)
instead of using BarsSince(d) < Barssince(f);

it can be simply written as A>B

also do you want your system to fire on the long trigger and stay until a short trigger?
Cherian  
#8 Posted : Thursday, November 8, 2012 12:24:50 PM(UTC)
Cherian

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/8/2012(UTC)
Posts: 7

Thank you very much for your time and efforts. I will try this tomorrow with real time feed and revert. Regards, Cherian
Cherian  
#9 Posted : Thursday, November 8, 2012 12:32:55 PM(UTC)
Cherian

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/8/2012(UTC)
Posts: 7

ok. i want the system to fire an alert on the long trigger just once, these alerts must not repeat upon completion of every bar even if the conditions on the long side are met. The next fire should be when the conditions on the short side are met.
henry1224  
#10 Posted : Thursday, November 8, 2012 12:57:16 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)
Code:

a:=Fml( "SwingTrd 2"); 

b:=Fml( "SwingTrd 3"); 

d:=Cross(a,b); 

f:=Cross(b,a); 

Long:=H>ValueWhen(1,d,H) AND A>B;

Short:=L<ValueWhen(1,f,L) AND B>A;

Signal:= If(BarsSince(Long)<BarsSince(Short),1,If(BarsSince(Short)<BarsSince(Long),-1,0));

{Make the last line of code whatever signal you want}

{LongEntry} Signal=1 and Ref(Signal,-1)<>1

{LongExit} Signal<>1 and Ref(Signal,-1)=1

{ShortExit} Signal=-1 and Ref(Signal,-1)<>-1

{ShortExit} Signal<>-1 and Ref(Signal,-1)=-1
this is a stop and reverse type of system
Cherian  
#11 Posted : Saturday, November 10, 2012 2:49:31 AM(UTC)
Cherian

Rank: Newbie

Groups: Registered, Registered Users
Joined: 11/8/2012(UTC)
Posts: 7

Hi Henry : It works...fantastic :-) Thank you very much. Regards, Cherian
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.