Alert vs. SendMail Syntax

 

I'm trying to have a custom indicator give me an Alert and also send me an email (Sendmail) when a criteria is met. The Alert is working. The SendMail is giving me errors.

')' wrong parameters count

Is there some kind of different syntax between the two that I should be aware of?

if(Alerts==True && last_alert!=Time[1])

{

last_alert = Time[1];

Alert(Symbol(), " ", Period(), " Min Sell Countdown Completed");

}

if(Text==True && last_sendmail!=Time[1])

{

last_sendmail = Time[1];

SendMail(Symbol(), " ", Period(), " Min Sell Countdown Completed");

}

Thank You in advance for your help!

 

1. Post your code with SRC button please

2. Wrong parameter count error : SendMail() has 2 parameters,

SendMail (string subject, string some_text);

you put in 4 values, they are Symbol(), and, " " and, Period() and, " Min Sell Countdown Completed". :(

This is what you should do :

string subject   = StringConcatenate (Symbol(), " ", Period());
string some_text = " Min Sell Countdown Completed";

SendMail( subject,  some_text);

Have fun :)

 
markarnold:

I'm trying to have a custom indicator give me an Alert and also send me an email (Sendmail) when a criteria is met. The Alert is working. The SendMail is giving me errors.

')' wrong parameters count

. . . just to add, get into the habit of checking the Documentation, learn where functions are in the documentation and learn how to understand the format that the information is given in . . .

Alert()

SendMail()

 
Thank You onewithzachy! That totally worked!
Reason: