Prototyped Function (MQL Function)









return type Function_Name ( data type Parameter_name1, data type Parameter_name2, ... )


There can be zero to any number of parameters.



double GetSpread()

{

   return( MathAbs(Bid-Ask) );

}



int GetSum( int a, int b)

{

   return( a + b );

}










Summary


When you create an MQL function, the name of the function within the MQL code will be the name of the function on the Advanced->MQL menu.


The name of the MQL Element in which the MQL code was entered can be named any available name, for example MyMql.


The function on the Advanced->MQL menu holds the MQL source code and can be edited at any time.


The function MyMql represents a call to the function on the Advanced->MQL menu.  It does not contain the MQL code, only a call to the underlying function with the parameters set specifically.