This simple application shows you how to write your own extension for Metatrader 4 (EA, indicator, library) in Java. The Java code is executed in a virtual machine which runs inside the terminal.exe (MT4) process.
- java folder
Contains a sample eclipse project with a simple EA Java implemenation.
- mql4 folder
Contains the MT4 code.
- vc folder
Contains a Visual Studio project with the sources for the MT4 Java connector.
-
Copy the folders from the mql4 source folder to your MT Terminal data directory. e.g. %APPDATA%\MetaQuotes\Terminal<Terminal>\MQL4
-
Open Visual Studio project and build (F7) DLL. Important: Please check the path for your Java SDK installation (Project settings -> VC++ directories - Include directories)
-
Copy DLL to your Metatrader installation directory /experts/libraries
-
Open the eclipse project and export the project as JAR file.
-
Copy the JAR file to /experts/libraries
-
Edit JVM configuration file /experts/libraries/mt4j.properties and adjust the path to your JVM dll and your JAR file.
-
Restart MT4. In the navigator panel under "Experts" you should now see the mt4jSample EA