e-mail when price reach a specific value.

 

Hi everyone I need a script (or some feature), be able to send me an e-mail message, when the "price"(ask or bid) of a "Pair" in Forex reaches a "specific value"(Price)

Does somebody knows how to do that ??

Thanks in advance

Marcelo Semino

 

You need to configure an e-mail registration with smtp allowed in tools/settings/e-mail. The rest is easy:

void OnStart()
  {
   bool are_we_there_yet=false;
   double where=1.234567;
   
   while(!are_we_there_yet)
     {
      MqlTick the_last_tick;
      SymbolInfoTick(_Symbol,the_last_tick); 
      if(the_last_tick.bid>where) if(SendMail("some text for subject","some text for body")) are_we_there_yet=true;
      Sleep(5678);
     }
  }
 

You are a genius, BUT I dont know "nothing" about MQL languaje.

I know how to configure an SMTP on my MT5 Terminal.

Would you perform some kind of "Script" on these then I can install directly on MT5 Terminal ?


Should I Copy and save your script and it ill work on my MT5 ?


Thanks in advance !!!

 
Marcelo Semino:

You are a genius, BUT I dont know "nothing" about MQL languaje.

I know how to configure an SMTP on my MT5 Terminal.

Would you perform some kind of "Script" on these then I can install directly on MT5 Terminal?


Should I Copy and save your script and it ill work on my MT5 ?


Thanks in advance !!!

If You post Your details someone can do better screenshots with Your details filled in

Regards :)


PS

I recommend to invest some time to learn mql5 basics ,just by going quickly throo help file and see what is inside, then You would know where to look for things quicker then posting this type of questions on forum :). The documentation  : https://www.mql5.com/en/docs   is awesome and just by discovering the names of the functions You will learn a lot what can be done, and most functions have the example.

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

and also if You type "mt4 sendmail" on YouTube   ...you will have a lot of videos how to do it and what the tricks.  ...Personally I recommend  to learn mt5 instead mt4 (but this is my personal opinion)  ...you  starting from the beginning and mt5  is bit more complicated (not as hard as everybody describes)  ..but is hips more flexible and more future proof

Regards and goodluck

MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5
MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5
  • www.mql5.com
MetaQuotes Language 5 (MQL5) is a high-level language designed for developing technical indicators, trading robots and utility applications, which automate financial trading. MQL5 has been developed by MetaQuotes Software Corp. for their trading platform. The language syntax is very close to C++ enabling programmers to develop applications in...
Reason: