Download MetaTrader 5

PlaySound and Alert - page 2

To add comments, please log in or register
ma
239
ma  
Thanks Zap,

I really appreciate that. Actually, this is an EA. I am just trying to send an e-mail, or play a sound in the middle of my EA, but looks like it is impossible:) If I write this small program in a script it works fine, but when I write it in an EA, it doesn't work.

Might have something I am missing here. Any clue would be must welcome.

Thanks again folks.
zap
181
zap  
Well, keep in mind that EAs run on incoming ticks. Put a counter to a comment, in order to monitor tick flow. There are periods (like US nigth time) when there are no new ticks for 10s of minutes, and there are no ticks on weekends at all.
Init() runs whenever you attach your EA (this is the point of it), but start() will only run first on the first new tick: this is important!
ma
239
ma  
Thanks again. I see what is the problem. But how I can fix that?

Let's say I want to send an e-mail every time a new H4 bar starts. That seems very simple, but I have no clue how to do it. Please, which code should I put in my EA? Thanks again all of you folks.


//+------------------------------------------------------------------+
//|                                                    H4 e-mail.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        https://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "https://www.metaquotes.net"

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   
 
CODE FOR SENDING ONE E-MAIL EACH FOUR HOUR AT THE BEGINNING OF A H4 BAR. THANKS 
 
 
//----
   return(0);
  }
//+------------------------------------------------------------------+
ma
239
ma  
Ok.... I would like to say that the e-mail is working properly now. thank you guys for the help.
ron
154
ron  
brspMA:
Ok.... I would like to say that the e-mail is working properly now. thank you guys for the help.

How did you get the email to work??? I have yet to see a documented "How to..." for setting up the email function.

whroeder1
15566
whroeder1  
brspMA:
Let's say I want to send an e-mail every time a new H4 bar starts. That seems very simple, but I have no clue how to do it.
int start(){
   static datetime Time0;    bool new.bar    = Time0 < Time[0];
   if (!new.bar) return;                       Time0 = Time[0];
   ...
or
int start(){
   static datetime Time0;    if (Time0 < Time[0]){  Time0 = Time[0];
      ...
   }
12
To add comments, please log in or register