Download MetaTrader 5

SendMail syntax

To add comments, please log in or register
Icham Aidibe
9974
Icham Aidibe  

Hi i'm trying to use strings & variables inside SendMail() ... :

SendMail("Notify : Close opened position","Closed at : Ask="+SYMBOL_ASK+", Bid="+SYMBOL_BID+
         ", Date="+SYMBOL_TIME+" Symbol="+Symbol()+" Period="+Period()" Profit="+PositionGetDouble(POSITION_PROFIT));

errors i got :

'' - double quotes are needed

');' - unexpected end of program

Alain Verleyen
Moderator
31203
Alain Verleyen  

Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.

Icham Aidibe
9974
Icham Aidibe  
angevoyageur:

Hello,

Please use the SRC button when you post code. Thank you.


This time, I edited it for you.

yep, sorry. may you help me ?
Alain Verleyen
Moderator
31203
Alain Verleyen  
blouf:
yep, sorry. may you help me ?

Certainly :

You can't use SYMBOL_BID, SYMBOL_ASK...this way, you have to use SymbolInfoDouble().

Icham Aidibe
9974
Icham Aidibe  
angevoyageur:

Certainly :

You can't use SYMBOL_BID, SYMBOL_ASK...this way, you have to use SymbolInfoDouble().

I thought it was a syntax problem since the error I get when using :

Profit = PositionGetDouble(POSITION_PROFIT);

if(EmailON) SendMail("Notify : Close opened position","Closed at : Ask="+SYMBOL_ASK+", Bid="+SYMBOL_BID+", Date="+SYMBOL_TIME+" Symbol="+Symbol()+" Period="+Period()" Profit="+Profit);


is :

' Profit=' - some operator expected  

Icham Aidibe
9974
Icham Aidibe  
*** Solved by closing the + after Period(). ***
To add comments, please log in or register