-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplify setup in MetaTrader by pre-compiling MQL4 files in the maven…
… build
- Loading branch information
Showing
5 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
# Trading4j | ||
Trading4j is a library that allows to write automated expert advisors for Forex trading. The library promotes writing code that is reusable across different expert advisors by clearly separating between different aspects of expert advisor programming. Examples for these aspects are strategies, indicators, money management and order filtering. | ||
|
||
Expert advisors written with trading4j can place orders through the well known trading terminal <b>MetaTrader</b>. Therefore a wide range of brokers is supported while still having all the benefits of programming on the Java platform. | ||
Expert advisors written with trading4j can place orders through the well known trading terminal *MetaTrader*. Therefore a wide range of brokers is supported while still having all the benefits of programming on the Java platform. | ||
|
||
# Getting Started | ||
To get started with programming with trading4j take a look at the <b>examples</b> directory. The example contains a server that serves an exemplary expert advisor. | ||
To get started with programming with trading4j take a look at the *examples* directory. The example contains a server that serves an exemplary expert advisor. | ||
|
||
The directory <b>client-metatrader</b> contains a MetaTrader compatible expert advisor. This expert advisor will connect to the server created with trading4j to delegate the trading decisions. To install it, build the Maven project <b>client-metatrader</b>. At the moment you need a C/Windows cross-compiler named <b>i686-w64-mingw32-gcc</b>. In Ubuntu 16.04 you can get this by installing the package <b>mingw-w64</b>. After the build you get a ZIP bundle in the target folder. Unzip it in the MetaTrader directory. Open the MetaEditor and compile the newly installed expert advisor <b>Trading4jRemoteExpertAdvisor.mq4</b>. After that, the expert advisor is available in MetaTrader terminal, e.g. for backtesting or live trading. | ||
The directory *client-metatrader* contains a MetaTrader compatible expert advisor. This expert advisor will connect to the server created with trading4j to delegate the trading decisions. To install it, enable building the Maven project *client-metatrader* by activating the Maven Profile *client-metatrader*. At the moment you need a C/Windows cross-compiler named *i686-w64-mingw32-gcc*. In Ubuntu 16.04 you can get this by installing the package *mingw-w64*. You also need *wine* and a *MetaTrader* installation. You need to set the Maven property *metaeditor.executable* (e.g. in your *settings.xml*) to point to the *metaeditor.exe* executable. A working Maven comand line could look as the following: `mvn -Pclient-metatrader -Dmetaeditor.executable="~/.wine/Program Files (x86)/MetaTrader 4/metaeditor.exe" install`. | ||
|
||
After the build you get a ZIP bundle in the target folder. Unzip it in the MetaTrader directory. The expert advisor should now be available in MetaTrader terminal, e.g. for backtesting or live trading. | ||
|
||
In future a pre-compiled version of the client is planned to simplify the setup of the client for MetaTrader. | ||
|
||
# License | ||
Trading4j can be used under the terms of the <b>GNU General Public License Version 3</b>. | ||
Trading4j can be used under the terms of the **GNU General Public License Version 3**. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
METAEDITOR="$1" | ||
|
||
BASE_DIR="`dirname $0`/../../.." | ||
TARGET="$BASE_DIR/target" | ||
MQL_SOURCE="$BASE_DIR/src/main/mq4" | ||
MQL_BUILD="$TARGET/mq4" | ||
|
||
echo compiling mq4 files to "$MQL_BUILD" | ||
|
||
mkdir $TARGET | ||
rm -r $MQL_BUILD | ||
cp -r $MQL_SOURCE $TARGET | ||
wine "$METAEDITOR" /compile:"`winepath -w $MQL_BUILD`" | ||
|
||
# return status of metaeditor seams to be allways non-zero, at least when executed with wine | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters