Help with sendemail, i need to add symbol

 

Hi,


i am using a script i found online which sends email at MA crossover. It works, however i doesnt tell me the pair, so i have to add the symbol parameter


 if (SendAnEmail) SendMail("Price closed above MA"," + Symbol() + ");


If i do the above line, it sends the email but just puts the text + Symbol() + in the body of the email not the actual pair names.


Can someone please tell me the correct syntax?

 

Remove the quotation marks around Symbol() function:

if (SendAnEmail) SendMail("Price closed above MA on " + Symbol() + ", " + EnumToString((ENUM_TIMEFRAMES)_Period), "email body");


Please note that the first parameter of SendMail() function is email header, and the second parameter (after the coma) is email body:



bool  SendMail(
   string  subject,       // header
   string  some_text      // email text
   );

https://www.mql5.com/en/docs/common/sendmail


Regards.

Documentation on MQL5: Common Functions / SendMail
Documentation on MQL5: Common Functions / SendMail
  • www.mql5.com
Common Functions / SendMail - Reference on algorithmic/automated trading language for MetaTrader 5