Why is Amibroker showing the same time for generated alerts in analysis window?


I am using a very simple AFL code to generate buy, sell signals:

Buy = Cross(MACD(), Signal());
Sell = Cross(Signal(), MACD());

AlertIf( Buy , "SOUND C:\\Windows\\Media\\chimes.wav", "Audio alert", 2 );
AlertIf( Sell , "SOUND C:\\Windows\\Media\\alert.wav", "Audio alert", 2 );

I am using the above code to generate signals, now I've set up the analysis pane to auto refresh every 15 seconds to check if one of the above conditions is met.


Still I don't get alerts as the day passes even though I had manually checked in the charts that MACD crossover had happened. Only when the market starts, I got a few alerts and that too with the same time, i.e, 9:15 AM why doesn't the time change?



As documented http://www.amibroker.com/guide/afl/alertif.html, you should pass DIFFERENT value in "type" parameter for Buy and for Sell, because by default, repeated signals of same type are silenced .

Buy = Cross(MACD(), Signal());
Sell = Cross(Signal(), MACD());

AlertIf( Buy , "SOUND C:\\Windows\\Media\\chimes.wav", "Audio alert", 1 /* use unique type ! */);
AlertIf( Sell , "SOUND C:\\Windows\\Media\\alert.wav", "Audio alert", 2 /* use unique type ! */ );

And timestamp is basically bar START time.


I tried your code but it didn't change anything, no alert was generated, also what is the correct of setting up time frame because every day I have to set it up to the current day ex: 07-02-2018 in from and 07-02-2018 in to, it doesn't change automatically, I have to manually increment it every day I open Amibroker.


As you can see in the above image, I've set up date in from and to column to today. Now when I select "1 recent bar(s)" in range select box and press scan, it doesn't generate anything. But if I set it to "All quotes", the same result is achieved of which I posted screenshot in my first comment. It contains results of signals generated outside of the set time frame, i.e, 07-02-2018

I only want signals to be generated after the market opens and before the market closes in real time. It would help if I get the correct timestamp because if all timestamps show same time, i.e, 9:15 AM, I would never know when a signal was generated.


Quite obviously you did not understand even a single bit from what is written in the docs and what I wrote (with bold letters). For this reason, it would be better for you to just use simpler function: http://www.amibroker.com/guide/afl/playsound.html

There are last two notes in Users' Guide you should read and absorb: https://www.amibroker.com/guide/h_alerts.html

"Few words are spoken; but if the mind has truly caught them, they come into their strength and spring up." - Seneca, Moral letters to Lucilius, Letter 38