MACD crossover AFL to send an email ALERT RT not working

Hi All,

I've coded a simple MACD crossover AFL to send an email ALERT RT when the crossover happens to the upside/downside. And I have also changed the amibroker settings to send email alerts. I'm using True data downloader for RT data. But still, when the crossover happens the alerts are not generated.
Please, can somebody look at the afl below and suggest what's wrong.

PFA screenshot for reference.

SetChartBkColor(ParamColor("Panel color ",colorBlack));
r1 = Param( "Fast avg", 12, 2, 200, 1 );
r2 = Param( "Slow avg", 26, 2, 200, 1 );
r3 = Param( "Signal avg", 9, 2, 200, 1 );
Plot( ml = MACD(r1, r2), StrFormat(_SECTION_NAME()+"(%g,%g)", r1, r2), ParamColor("MACD color", colorRed ), ParamStyle("MACD style") );
Plot( sl = Signal(r1,r2,r3), "Signal" + _PARAM_VALUES(), ParamColor("Signal color", colorBlue ), ParamStyle("Signal style") );
Histogram_color = IIf( ml-sl > 0, colorBlue, colorRed);
Plot( ml-sl, "MACD Histogram", Histogram_color, styleNoTitle | ParamStyle("Histogram style", styleHistogram | styleThick | styleNoLabel, maskHistogram ) );
Title = EncodeColor(colorWhite)+ "";

x = ml;
y = sl;


AlertIf( Buy, "EMAIL", "MACD Crossover "+FullName(), 1 );
AlertIf( Sell, "EMAIL", "MACD Crossover "+FullName(), 1 );

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

/* End - MACD Crossover */




Similar threads

Broker Special Offers

Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

Are you a day trader?