Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1959

 
Hello friends, please help me set up an email alert. Gives an error, I don't know why. I'm sending screenshots. Thank you.
 

Please help me solve the problem


 
Translation of a message in an alert from MT-4
 
@Mykhailo Turovskyi #: Hello friends, please help me set up an email alert. Gives an error, I don't know why. I'm sending screenshots. Thank you.

Please search for other related posts besides the ones below.

Forum on trading, automated trading systems and testing trading strategies

Looking for Working SMTP server for e-mail sending

Robert Gerald Wood, 2022.06.07 14:11

Hi,

I use GMail to send emails, you just have to setup an App Password for Gmail. 

https://support.google.com/mail/answer/185833?hl=en-GB

Once you have your app password, you setup the email in metatrader as usual, just using the app password instead of your gmail account password.


Hope it helps.

Forum on trading, automated trading systems and testing trading strategies

SMTP connection fails

Eleni Anna Branou, 2022.08.18 17:15

Email notifications work fine, check your email MT4/5 settings.


You go to MT4/5 >> Tools >> Options >> Email tab and you fill in the necessary details for your email and server, in order to receive your email notifications. Below is an example of the details that are required and a list of the most popular email providers and their SMTP settings.

  • In the SMTP server field you need to put your email provider’s SMTP address, you can see most of the popular providers below.

  • In the SMTP password field, you need to put your email’s password.

  • In the From and To fields, you need to put your full name a comma and then your email again, for example: John Smith, johnsmith@gmail.com


List of SMTP Mail Servers: https://domar.com/pages/smtp_pop3_server


Gmail: smtp.gmail.com:465

Outlook-Hotmail: smtp-mail.outlook.com:587

Yahoo: smtp.mail.yahoo.com:465

iCloud: smtp.mail.me.com:587

Mail.com: smtp.mail.com:465

Mail.ru: smtp.mail.ru:25

Zoho: smtp.zoho.com:465

Gmx.com: smtp.gmx.com:465



 
I am trying to code my system however after compiling it returns the "not all control paths return a value"
----------------------------------
string buyorder()
{
if((iMA(Symbol(),PERIOD_CURRENT,200,0,MODE_SMA,PRICE_MEDIAN,1)-(10*Point))<=iLow(Symbol(),0,1)&&
(iMA(Symbol(),PERIOD_CURRENT,200,0,MODE_SMA,PRICE_MEDIAN,1)+(10*Point))>=iLow(Symbol(),0,1)&&
(((iMA(Symbol(),PERIOD_CURRENT,200,0,MODE_SMA,PRICE_MEDIAN,2)-(10*Point))<=iLow(Symbol(),0,2)&&
(iMA(Symbol(),PERIOD_CURRENT,200,0,MODE_SMA,PRICE_MEDIAN,2)+(10*Point))>=iLow(Symbol(),0,2))
||iLow(Symbol(),0,2)>=iMA(Symbol(),PERIOD_CURRENT,200,0,MODE_SMA,PRICE_MEDIAN,2)))

return("Please_Buy");

}
Files:
Untitled.jpg  479 kb
 
amin parvini #: "not all control paths return a value"
  1. Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum #25 (2019)
              Forum rules and recommendations - General - MQL5 programming forum (2023)
              Messages Editor

  2. string buyorder(){  <<<<<<<< function returns a string.
       if(condition) statement;
     <<<<<<<<<<<<<<<<<<<<<<<<<<< what are you returning here?
    } <<<<<<<<<<<<<<<<<<<<<<<<<< end of function.

 
Comments that do not relate to this topic, have been moved to "Off-topic MQL question".
 
how can i sum two integers that in same string ?
Example
string test="5+7";
i want the result be 12 in integer
 
hamdy elmarghany #:
how can i sum two integers that in same string ?
Example
string test="5+7";
i want the result be 12 in integer
There is no simple way to do that in MQL, you would need to parse the string to identify the operands and operator to apply.
 
Alain Verleyen #:
operator
Thank you, Alain, for your reply. Could you please tell me which function I can parse the string ?
Reason: