What is proper order of execution?

 

Hi; wrote this code that will send order entry confirmation to monitor screen and cell phone.

            if(TimeStamp != Time[0]) {                
               SendNotification("SELL Order Possible! / "+Currency);            
               MessageBox("SELL Order Possible! ("+Currency+" / LS: "+DoubleToString(LotSize,2)+")",
                        "SELL ORDER NOTICE",MB_ICONINFORMATION);              
               TimeStamp = Time[0];
            } 

Code works but seems to execute in different order:  cell phone notification is only send AFTER

I click the OK button on the message box.  Any reason why?  How can I change that?


Thank you.


Lode

 
what if you place sleep in between? its an indicator ?
 
Lode Loyens:   Any reason why?  How can I change that?

Send notification adds an event to the processing queue. Nothing will happen until your indicator returns.

 

It's an EA.  Thanks for the input.  Sleep delays the messagebox.  As for nothing happens till the indicator returns, are you saying that

a tick needs to happen first before the send notification is processed?  If so, why is this not the case with messagebox?

Or is something else other than a tick influencing the processing queue?  

Thanks


Lode

 
Lode Loyens #: Or is something else other than a tick influencing the processing queue? 

Did I say anything about a tick? What part of "return" was unclear?

Don't double post! You already had this thread open.
          General rules and best pratices of the Forum. - General - MQL5 programming forum #6 (2017)

 

Hi William;

Thanks for answering.  Actually, your entire sentence isn't clear: " Nothing will happen until your indicator returns."

What does that mean?  What "returns" an indicator?  


Lode

 
Lode Loyens # Actually, your entire sentence isn't clear: " Nothing will happen until your indicator returns." What does that mean?  What "returns" an indicator?  

Only when the current event handler (that is being run), ends its execution and returns control, does it then update.

This can be when the code reaches it's final closing " } " or when you issue a "return;" in your code.

{
    ...
   return;
};
By event handler, I mean OnCalculate(), OnTimer(), OnTick(), etc.
 

Got it.

Thank you so much, truly appreciate all of you.


Lode