It creates and shows a message box and manages it. A message box contains a message and header, any combination of predefined signs and command buttons.

int  MessageBox(
   string  text,             // message text
   string  caption=NULL,     // box header
   int     flags=0           // defines set of buttons in the box



[in]  Text, containing message to output.


[in]  Optional text to be displayed in the box header. If the parameter is empty, Expert Advisor name is shown in the box header.


[in]  Optional flags defining appearance and behavior of a message box. Flags can be a combination of a special group of flags.

Return Value

If the function is successfully performed, the returned value is one of values of MessageBox() return codes.


The function cannot be used in custom indicators since calling MessageBox() suspends the thread of execution for the whole time while waiting for the user's response. Since all indicators for each symbol are executed in a single thread, such suspension makes the operation of all charts on all timeframes for this symbol impossible.

MessageBox() function does not work in the Strategy Tester.