Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

Script calling library for MT4 build 600 and higher - Libraries for MetaTrader 4 - MetaTrader 4 Resources

author EAcpu | 5 reads | 0 comments |

This is the script call library for MT4 build 600 and higher.

This library is used to call scripts from your indicators and Expert Advisors.

In earlier versions of MT4, this could be achieved in the following way.

Around build 509, the message parameters may have changed.

wParam is 0x11, lParam is the serial number of the Navigator tree view, starting from 0 (the top script is 0).

The library includes DLL and MQL class libraries.

The source is hosted on GitHub ( CodeBase version may be out of date. Check here for new versions ).

If you have trouble:

I welcome bug reports as GitHub issues .

Add the following include line to your indicator or Expert Advisor

 #include <script caller. class.mqh >
  • Add the following code to initialize/uninitialize class instances.

     Script Caller *g_scriptCaller = void ; integer initialize ()
    {
      g_scriptCaller = new script caller();
    Return initialization successful ;
    } Blank solution initialization ( constant integer reason)
    {
    if (g_scriptCaller){
    Delete g_scriptCaller;
      }
    }
  • Finally, put in the following code to call the script!

     g_scriptCaller.callScript( "script name" ); // Do not end with .mq4
  • If the script displays an input dialog and you want it to be closed automatically, call it as follows.

     g_scriptCaller.callScript( "script name" , true ); // If the second parameter is true, the dialog box will automatically close.

  • Under MQL4\Indicators, there are 2 example indicators, which call scripts under MQL4\Scripts.

    This software is licensed under the GNU General Public License, version 3.

    Update history:


    Attachment download

    📎 code_11139.zip

    Source: MQL5 #11139

    mt4 MQL5 CodeBase and later versions of the script call library
    Verification code Refresh