Alert Buy or Sell Signal

Hello everybody,

I'm newbie. I try rewrite code free in GG. But I'm have problem with alert mail and Sound. Aler mail and Sound repeat all the time. Help me fix my code?? Tks All
Capture

perc=per1;
x=BarIndex();xx=SelectedValue(x);
t1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,x)) ;
H1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,C)) ;
t11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, x));
H11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, C));
g1=t1>t11;
g2=t11>t1;
shape=IIf(g1,shapeDownArrow*(x==t1),shapeUpArrow*(x ==t11));
Color=IIf(g1,colorRed,colorGreen);
PlotShapes(shape,color);
AlertIf(g1,"EMAIL","Sell@"+C,2);
AlertIf(g1,"SOUND C:\Windows\media\Alarm01.wav","Audio alert",2);
AlertIf(g2,"EMAIL","Buy@"+C,2);
AlertIf(g2,"SOUND C:\Windows\media\Alarm01.wav","Audio alert",1);

First you have to check why your code generates so many consecutive signals.

You have provided partial code which wont suffice. Also, any code is logically always correct, unless you explain what Logic is intended and what is not expectedly happening.

There is _TRACE() for debugging: Kindly use it

Here, is an AlertIf flag that can be used to supress signals, try if it works:

https://www.amibroker.com/guide/afl/alertif.html

8 - don't display repeated alerts having the same date/time) By default all these options are turned ON.

Next

Also read about ExRem to remove excessive signals, this is almost mandatory :slight_smile:
https://www.amibroker.com/guide/afl/exrem.html
Eg.

buy = ExRem( buy, sell );
sell = ExRem( sell, buy ); 
1 Like

Hi travick,

Sorry for trouble you. I have a concern about how Amibroker works in real time?
Just open Amibroker in Windows => Open the Chart with my afl code? and it will work or Do I need to do any setting or change to a special mode?

My alert works well when I test. But i feel like if I dont active Amibroker windows and the Chart which have AFL alert (for example: when I open Chrome browser or open another chart or Coding new AFL on AFL editor), it doesn't make alert.
:confused::confused::confused:

I cannot edit my previous post

I intented to Open 1 Amibroker windows and 3 or more Chart with different timeframe or Symbol.

I realize Amibroker only make Alert for only 1 active chart instead of all Chart, or If I Minimize Amibroker it will stop alert.

Do you have any idea to deal with this?
Or how can I can Monitor which AFL alert is running in background?
Is there any setting or Panel in amibroker for this?

image

1 Like