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...
|
|
|
|
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.
|
|
|
|
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)
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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?
|
|
|
|
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
|
|
|
|
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.
|
|
|
|
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
|
|
|
|
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.