How to get sound alerts in amibroker?

With all the info ive gathered, I have been tinkering with the code to get sound alerts. All the time it falls short. Sometimes it shouts even when the candle is forming, or doesnt alert all the time or alerts only for a few instruments. I have zero coding knowledge. I have following requirements.

1. Get sound alerts like to say what i define in the code. So whenever a buy signal occurs it should say "Buy Now" or whatever is put in the code. Would also be better if it also says the ticker name. The most important thing is for the sound alert to come after the closing of the candle.

2. Now the same alert system if i put a code in AutoScan mode in analysis window.

I attach a sample code below. Do modify.

SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
_N( Title = Title +"\n" + _DEFAULT_NAME() );

Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );

Buy =     Close > Open
    AND MACD( 12, 26 ) > MACD( 6, 13 );

Sell = Close < Open
    AND MACD( 12, 26 ) < MACD( 6, 13 );

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,Low,Offset=-15);

PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),coloryellow,0,Low,Offset=-50);

1 Like

Please find the alert code below.

if (SelectedValue(Buy)==1) Say("BUY Signal Now ");
if (SelectedValue(Sell)==1) Say("Sell Signal Now");

Please add this after Buy and Sell are set in your AFL.

www.neotradeanalytics.com (Legal NSE realtime data vendors for FNO and CDS with affordable rates)

1 Like

Did you try the below option?

SetChartOptions(0,chartShowArrows|chartShowDates);

_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

_N( Title = Title +"\n" + _DEFAULT_NAME() );

Plot( C, “Close”, ParamColor(“Color”, colorDefault ), styleNoTitle | ParamStyle(“Style”) | GetPriceStyle() );

Buy = Close > Open

AND MACD( 12, 26 ) > MACD( 6, 13 );

Sell = Close < Open

AND MACD( 12, 26 ) < MACD( 6, 13 );

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,Low,Offset=-15);

PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),coloryellow,0,Low,Offset=-50);

Yay, Ive this already. What it does is alert even when the candle is forming if a signal comes. What i want is underlined in my question.

You seem to have put the same code i put. Where is the alert part in this code?

Please use this code
CandComp = ParamList(“Candle Completion”,“No,Yes”,1);
if(CandComp==“Yes”)
{
Buy=Ref(Buy,-1);
Sell=Ref(Sell,-1);
if (SelectedValue(Buy)==1) Say("Buy Signal triggered " + Close);
if (SelectedValue(Sell)==1) Say(“Sell Signal triggered” + Close);
}
www.neotradeanalytics.com (NSE Realtime data vendors)