Can Someone Please Add "SendMail" Feature to this Alert ?

 

This indicators alerts me and pops a message when:


..Classical Bullish Divergence

..Hidden Bullish Divergence


..Classical Bearish Divergence

..Hidden Bearish Divergence.



Alerts are Perfectly fine but i just want it to email me also.

Please I will be greatly appreciative. Thank you in Advance.

 

Where do I add "sendmail" command to this script? It alerts me fine, but I also want it to send an email too :(



//----

if(macd[currentTrough] >= macd[lastTrough] &&
Low[currentTrough] <= Low[lastTrough])
{
bullishDivergence[currentTrough] = macd[currentTrough] -
arrowsDisplacement;
//----
if(drawPriceTrendLines == true)
DrawPriceTrendLine(Time[currentTrough], Time[lastTrough],
Low[currentTrough],
Low[lastTrough], ColorBullishTrendLines, STYLE_SOLID);
//----
if(drawIndicatorTrendLines == true)
DrawIndicatorTrendLine(Time[currentTrough],
Time[lastTrough],
macd[currentTrough],
macd[lastTrough],
ColorBullishTrendLines, STYLE_SOLID);
//----
if(displayAlert == true)
DisplayAlert("Classical bullish divergence on: ",
currentTrough);

//----
/* if(alert_ON == true)
{
Alert ("Classical bullish divergence on ",Symbol(),"-",TimeFrame);
PlaySound("timeout.wav");
turn_alarm=false;
}*/
}
 
phornduong01 wrote >>

Where do I add "sendmail" command to this script? It alerts me fine, but I also want it to send an email too :(

//----

if(macd[currentTrough] >= macd[lastTrough] &&
Low[currentTrough] <= Low[lastTrough])
{
bullishDivergence[currentTrough] = macd[currentTrough] -
arrowsDisplacement;
//----
if(drawPriceTrendLines == true)
DrawPriceTrendLine(Time[currentTrough], Time[lastTrough],
Low[currentTrough],
Low[lastTrough], ColorBullishTrendLines, STYLE_SOLID);
//----
if(drawIndicatorTrendLines == true)
DrawIndicatorTrendLine(Time[currentTrough],
Time[lastTrough],
macd[currentTrough],
macd[lastTrough],
ColorBullishTrendLines, STYLE_SOLID);
//----
if(displayAlert == true)
DisplayAlert("Classical bullish divergence on: ",
currentTrough);

//----
/* if(alert_ON == true)
{
Alert ("Classical bullish divergence on ",Symbol(),"-",TimeFrame);
PlaySound("timeout.wav");
turn_alarm=false;
}*/
}

Add it in your code where ever you have the alert command. let me know how it works out. - If you want send me the source code and let me include it for you

 
phornduong01:

Where do I add "sendmail" command to this script? It alerts me fine, but I also want it to send an email too :(


//----

if(displayAlert == true)

{

DisplayAlert("Classical bullish divergence on: ",

currentTrough);

/*sendmail here*/

}

 

I would create a separate email function. If you plan to ALWAYS combine an email with your alert, then you could call the email function from your alert function.

I would also recommend you to set up string variables for MessageSubject (used by email function only) and MessageText (used by alert and email functions) and pass the variables with the function calls.

The key part of your email function will be a call like this:

SendMail(sMessageSubject,sMessageText);

But the reason I'd have a separate function is in order to set up your email message based on the content of the alert. You may wish to take the alert text, summarise it for the email subject line and add some formatting for the email body.

Up to you, but please think "modular", think "easy to maintain", think "write reusable code components".


CB

Reason: