How to create alert on shape color change

Hi,

I have written a logic to change the ShapeCircle to ColorRed on Amibroker chart if there is a sell signal. I want to incorporate a sound alert when the ShapeCircle changes it's color. Can anyone please guide me how to achieve this? I have gone through Amibroker guide as well but unable to write the appropriate logic. Please help.

Here is the sell signal generator which changes shape color to red:

PlotShapes( IIf( DownBear, shapeCircle, shapeNone ), colorRed, 0, disVal, 0 );

Alertif (" ") ?

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

I posted this post as I am unable to write the logic and categorically said that I have gone through Amibroker guide to resolve it but in vain. I guess you haven't read my problem word by word.

@sandeeppanja there's a big difference between plotting shapes on n past bars and triggering live alerts/notifications as they happen. You don't want to be alerted about every event which happened in the past, every time the code is executed. You can achieve your goal by using AlertIf() function or implement another solution - for example study my example code. You can modify it to suit your needs:

You can be alerted about some events (as they happen) by a PopUp window, spoken message, an email or in many other ways. If you just want a simple sound alert, you can use PlaySound():

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

Thanks a lot Milosz. It was a great help.

1 Like