Can I quit MQL4 processing and run a Function imediately

 

Hi Guys...

Was just wondering if there is a way to "run" a Function immediately.... 

ie. If I 'Click' on a Chart 'Button'.... can I tell Mql4 to 'Stop" processing what it is doing and run the Function that I want it to run.... 

...if that makes any sense....

...is there a Function that just "Stops" the processing....

 
MikeT:

Hi Guys...

Was just wondering if there is a way to "run" a Function immediately.... 

ie. If I 'Click' on a Chart 'Button'.... can I tell Mql4 to 'Stop" processing what it is doing and run the Function that I want it to run.... 

...if that makes any sense....

...is there a Function that just "Stops" the processing....

You can use this :

//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
 {
   if (id == CHARTEVENT_OBJECT_CLICK)
      {
         if (sparam == "Your Button Name" )
            {
                //Your Function 
            }
      }
 }
Reason: