Code Monkey home page Code Monkey logo

ea-tester's Introduction

EA Tester

Release License AppVeyor Status Status Status Status Discuss Channel Twitter Edit Code

About

Headless Forex backtesting for MetaTrader platform using Docker.

Usage

The easiest way is to install Docker, then run tester from the terminal:

docker run ea31337/ea-tester help

to list available commands.

Backtesting

Here is the example command for running backtest on MACD using historical data from 2019:

docker run ea31337/ea-tester run_backtest -e MACD -y 2019 -v -t

To backtest EA31337 bot, check: Backtesting using Docker.

CLI options

Check scripts/options.txt file for supported parameters and variables.

Support

ea-tester's People

Contributors

kenorb avatar lu43n avatar lucasbodek avatar nseam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ea-tester's Issues

Make -e to accept paths

Currently -e is searching for EA in different paths (find_ea).
When user provides a full path, this EA should be used explicitly, so when file is not found, then there should be fallback to the old method.

Make support for Docker.

Create Dockerfile in order to make support for Docker. So it should work similar as Vagrantfile in order to run tests.

So it can be equivalent to:

vagrant ssh -c "run_backtest.sh -v ..."

Add testing of custom HST/FXT files.

Given user copied HST/FXT files into VM folder, specifying:

./get_bt_data.sh EURUSD 2014 custom

should find and copy the these files into platform for testing.

Script to convert CSV into FXT and HST

Given CSV file, I'd like to convert it into FXT or HST (depending on the given parameter) which should be compatible with MT4 platform.

Create separate classes for handing different formats (csv, fxt and hst).

Proposed script name: convert_csv_to_mt.py and it should work from the command-line (Python 3.x).

Parameters:

  • -i csv - input should be in CSV format by default (in future more input formats can be added)
  • -f fxt4 should convert input file into FXT MT4 format (default)
  • -f hst4_509/-f hst4 should convert input file into HST MT4 format, where hst4_509 is the old format and hst4 is the newest,
  • -t TF where TF is one of the timeframe values: M1, M5, M15, M30, H1, H4, D1 (default: M1)
  • -s SP where SP is the spread value (float)
  • -d DIR where DIR is destination directory to save the output file
  • see more options in here.

Requirements:

  • if hst format selected, the output file should be in format: SSSSSSPP.hst (where SSSSSS - symbol name, PP - timeframe in minutes)
  • if fxt format selected, the output file should be in format: SSSSSSPP_0.hst (where SSSSSS - symbol name, PP - timeframe in minutes), for example: EURUSD1_0.fxt

Resources:

Shell script to run CSV2FXT mq4 via platform

Branch: dev

Test and correct the current run_script.sh script which is based on run_backtest.sh to run mq4 files as a scripts.

The goal of the script is to run CSV2FXT.mq4 using run_script.sh (similar as run_backtest.sh works).

You can use VM if you like (vagrant up) to test it.

The expected testing steps are (clone into HOME):

  1. (optonal) Provision VM via Vagrant and login via : vagrant up && vagrant ssh

  2. Clone Birt-CSV2FXT.

  3. Clone CSV files from FX-BT-Data-EURUSD-DS (EURUSD-2015 branch).

  4. Convert all or selected CSV files into a single file, e.g.

    find . -name '*.csv' -print0 | sort -z | xargs -r0 cat > all.csv
    
  5. Clone FX-MT-VM (dev branch).

  6. Please provide steps to compile and place CsvReader.dll into the right place, or any dependencies.

  7. Run: run_script.sh, e.g.

    ./scripts/run_script.sh -e CSV2FXT.mq4 -E CreateM1=true,StartDate=?,EndDate=?,Spread=10 -M4.0.0.988
    

    [ ] Find out about the right parameters. Modify script if necessary.

    You can use -B to include startup script if necessary, or -X for finish script.

    If you don't know the machine names of variables for mq4 script (-E), you can run platform manually (scripts/run_terminal.sh), then run the script from GUI, populate the settings and save into SET file.

  8. After running CSV2FXT with above method, the appropriate FXT is generated (either for a month, or a year).

You should basically:

  • Provide any extra steps not mentioned above.
  • Correct run_script.sh and related scripts in order to run mq4 script within the platform as shown above.
  • Generate FXT output file based on the provided CSV files using above method.
  • The changes shouldn't break the existing CI tests.
  • Automate the process when possible.

Any questions, please ask here, or join chat.

Est. 8-16h

codemill$100

Write script to install MT5 via winetricks

There is existing script which installs MT4 platform (install_mt4.sh).

The goal is to write new script to install MT5 platform (exe file).

Please check install_mt.sh (same script can be reused) as initial example which aims to load winetricks (it's assumed it's already installed) in order to load the necessary functions. Then use w_ahk_do function and other provided by winetricks to install the binary.

Here is example of installing Meta Trader 4 using winetricks, so it should be fairly similar. Use the latest version of wine. Check also this page for any compatibility issues or bugs.

Test for reading and checking ticks.raw

Complete the test file to verify whether the file is valid.

File: tests/TestTicksRaw.mq4

Testing:

./scripts/run_backtest.sh -v -e TestTicksRaw

On Windows, use Vagrant and run: vagrant up first and run above inside the VM.

Est. 2-4h

Lot step sometimes is 0

When testing with 5 digits, sometimes the lot step is 0. Although it works for 4 digits.

For example:

$ ./scripts/run_backtest.sh -v -t -e TestLotstep -D5 -m1 -y 2014
TestLotstep EURUSD,M1: Testing lot step...
TestLotstep EURUSD,M1: Symbol digits  : 5
TestLotstep EURUSD,M1: Lot step       : 0
TestLotstep EURUSD,M1: Error: Expected lot step for 5 digits: 0.01, found: 0
TestLotstep EURUSD,M1: initialization failed (1)

It works with -D4. For 5 digits, this works when connected to the valid server. This is most likely related to accounts.ini file which is encrypted which keeps the right values for 5 digits.

MODE_MARGINREQUIRED: 0

When testing, on certain platforms MODE_MARGINREQUIRED sometimes is zero.

Reproducible steps:

./scripts/run_backtest.sh -e TestMargin -v -t -c GBP -D5

This mainly happens, because the currency is GBP instead of USD. So some default data needs to be populated.

Set the right FXT values when the tick file is not read-only.

When tick data files aren't read-only (e.g. EURUSD1_0.fxt) during backtest, the FXT header is overridden by different data.

So original FXT file is changed from:

symbol = EURUSD
timeframe = 1
modelType = 0
totalBars = 372823
modelStart = 2015-01-01 22:00:00
modelEnd = 2015-12-31 21:59:00
padding1 = <...>
modelQuality = 99.9
baseCurrency = EUR
spread = 20
digits = 5
padding2 = <...>
pointSize = 1e-05
minLotSize = 1
maxLotSize = 50000
lotStep = 1
stopLevel = 0
GTC = 0
padding3 = <...>
contractSize = 100000.0
tickValue = 0.0
tickSize = 0.0
profitMode = 0
swapEnabled = 1
swapMethod = 0
padding4 = <...>
swapLong = 0.0
swapShort = 0.0
swapRollover = 3
accountLeverage = 100
freeMarginMode = 1
marginCalcMode = 0
marginStopoutLevel = 30
marginStopoutMode = 0
marginRequirements = 0.0
marginMaintenanceReq = 0.0
marginHedgedPosReq = 0.0
marginLeverageDivider = 1.0
marginCurrency = EUR
padding5 = <...>
commission = 0.0
commissionType = 0
commissionPerEntry = 0
indexOfFirstBar = 0

into:

symbol = EURUSD
timeframe = 1
modelType = 0
totalBars = 370084
modelStart = 2015-01-01 23:40:00
modelEnd = 2015-12-29 23:59:00
padding1 = <...>
modelQuality = 24.99345013564488
baseCurrency = EUR
spread = 10
digits = 4
padding2 = <...>
pointSize = 0.0001
minLotSize = 10
maxLotSize = 10000
lotStep = 10
stopLevel = 8
GTC = 1
padding3 = <...>
contractSize = 100000.0
tickValue = 0.0
tickSize = 0.0
profitMode = 0
swapEnabled = 1
swapMethod = 0
padding4 = <...>
swapLong = 0.33
swapShort = -1.04
swapRollover = 3
accountLeverage = 100
freeMarginMode = 1
marginCalcMode = 0
marginStopoutLevel = 30
marginStopoutMode = 0
marginRequirements = 0.0
marginMaintenanceReq = 0.0
marginHedgedPosReq = 50000.0
marginLeverageDivider = 1.0
marginCurrency = EUR
padding5 = <...>
commission = 0.0
commissionType = 0
commissionPerEntry = 0
indexOfFirstBar = 1

Tested by: read_mt_formats.py

We need to find the way of controlling these values and parameterize them.

Related: #94

Make run_test.sh parameterized.

Extend run_test.sh to accept parameters as specified below:

  • dir - where to save Reports file after test,
  • setfile - filename present in dir to load (change TestExpertParameters in ini file)
  • mode - (change TestExpert in ini file to e.g.: EA31337-Lite) where Lite is value of mode
  • symbol pair, e.g. EURUSD (change TestSymbol in ini file)
  • deposit (not sure where to set it)
  • year (TestFromDate and TestToDate should change, for 2014 we need: 2014.01.01-2014.12.30, day and month can be fixed)
  • spread (set spread for testing, not sure where)
  • source - backtest data source (either dukascopy or metaquotes), ignore for now

The syntax should be:

run_backtest "$dir" $setfile $mode $symbol $deposit $year $spread $source

As per: run_backtests.sh which will run the script.

Where run_backtest is alias to run_test.sh which should be defined in provision.sh, probably by:

sudo ex +'$s@$@\ralias run_backtest="/vagrant/script/run_backtests.sh"@' -cwq /etc/bashrc

Test for reading and checking symbols.sel

Complete the test file to verify whether the file is valid.

File: tests/TestSymbolsSel.mq4

Testing:

./scripts/run_backtest.sh -v -e TestSymbolsSel

On Windows, use Vagrant and run: vagrant up first and run above inside the VM.

Est. 2-4h

Make sure that your X server is running and that $DISPLAY is set correctly.

When running command: wine "$(find ~/.wine -name terminal.exe)"

I'm getting the following output:

fixme:ole:RemUnknown_QueryInterface No interface for iid {00000019-0000-0000-c000-000000000046}
fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d1400 (device=2d access=0 func=500 method=0)
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:advapi:EventRegister {5eec90ab-c022-44b2-a5dd-fd716a222a15}, 0x401123, 0x9c9be0, 0x9c9bf8
fixme:advapi:EventSetInformation 2, 0x99b170, 43
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:mountmgr:harddisk_ioctl returning zero-filled buffer for IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
fixme:mountmgr:harddisk_ioctl Unsupported ioctl 74080 (device=7 access=1 func=20 method=0)
fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d1400 (device=2d access=0 func=500 method=0)
fixme:mountmgr:harddisk_ioctl Unsupported ioctl 2d0c10 (device=2d access=0 func=304 method=0)
fixme:thread:GetThreadPreferredUILanguages 56, 0x33f568, 0x33f578 0x33f56c
fixme:module:load_library unsupported flag(s) used (flags: 0x00000060)
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
Application tried to create a window, but no driver could be loaded.
Make sure that your X server is running and that $DISPLAY is set correctly.
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)
fixme:module:load_library unsupported flag(s) used (flags: 0x00000800)

I installed:

But the error persists.

I typed startx in other terminal window - error persists.

What is the recommended way of running it?

EDIT: output of startx command:

tartx
font_cache: Scanning user font directories to generate X11 font caches
font_cache: Updating FC cache
expr: syntax error
expr: syntax error
xauth:  file /Users/ms/.serverauth.10759 does not exist
xauth:  file /Users/ms/.Xauthority does not exist
xauth:  file /Users/ms/.Xauthority does not exist


waiting for X server to begin accepting connections .
/opt/X11/bin/xinit: XFree86_VT property unexpectedly has 0 items instead of 1
font_cache: Done

Change current spread when spread is 0

Spread 0 (-s 0) means the current spread.

However when run, we're still having 0 spread, e.g.:

$ ./_VM/scripts/run_backtest.sh -v -t -e TestSpread -D5 -m1 -s0
Spread                              Current (0)

We should find the way how to change the current spread, so we can control it.

Est. 2-4h

Write a function to check whether the test results are empty or not

Example of empty test result:

Symbol          EURUSD (Euro vs US Dollar)
Period          1 Minute (M1) 2014.01.01 23:41 - 2014.12.29 23:59 (2014.01.01 - 2014.12.30)
Model           Every tick (the most precise method based on all available least timeframes)
Initial deposit 10000.00
Spread          10
                                    [Optimization Graph]
        Pass Profit Total trades Profit factor Expected Payoff Drawdown $ Drawdown %
           2   0.00            0          0.00            0.00       0.00       0.00
           1   0.00            0          0.00            0.00       0.00       0.00

When test is empty, the script shouldn't change the set file based on the first available Pass.

Support for backtesting multiple years at the same time.

The run_backtest.sh script should accept year range such as -y 2014-2015.

So script still can accept -y 2014, but also multiple years (- in parameter assumes it's a range).

Related code:

    E) # EA settings (e.g. genetic=0, maxdrawdown=20.00).
      EA_OPTS=${OPTARG}
      echo "Applying EA settings ($EA_OPTS)..." >&2
      IFS='='; ea_option=($EA_OPTS)
      IFS=$' \t\n' # Restore IFS.
      [ -f "$EA_INI" ]
      ini_set "^${ea_option[0]}" "${ea_option[1]}" "$EA_INI"
      ;;

and (the code change is most likely below):

    y) # Year to test (e.g. 2014).
      YEAR=${OPTARG}
      START_DATE="$YEAR.${MONTHS[0]:-01}.01"
      END_DATE="$YEAR.${MONTHS[1]:-$(echo ${MONTHS[0]:-12})}.30"

Testing:

./scripts/run_backtest.sh -v -t -e TestLotstep -D5 -m1 -y 2014-2015

Est. 4-8h

Fix tests when backtest files are read-only

When backtest script is run with -R, there are some errors. The problem is how FXT is generated and there are some settings which preventing back tests. When using specific FXT files it works fine. I can provide two examples (non-working and working scenario).

Branch: read-only
See: CI build.

Some FXT settings can prevent the testing with read-only mode.

It seems that FXT converted using go-duka tool allows test in read-only.

I just use golang FXT and set it to read-only, and mt4 start backtesting directly, I am surprised why tester don't report error.

Est. 6h

Add new column with parameters for optimization result file.

The goal is to parse generated report html file and modify before conversion to the text file, so it consist extra column with the current optimized settings.

Currently when running backtest via run_backtest.sh script (-t & -o), it is generates the following text format from html file:

          Pass  Profit Total trades Profit factor Expected Payoff Drawdown $ Drawdown %
             3 9448.94        60771          1.23            0.16    5093.25      35.09
             2 9448.94        60771          1.23            0.16    5093.25      35.09
             1 9447.97        60771          1.23            0.16    5093.25      35.10

See: _optimization_results.

We need to parse html format and copy settings value into separate column at the end.

So basically we need to add a new column into generated optimization result html report with settings used for each row,

screen shot 2016-03-29 at 00 49 50

The idea is to use the following ex command to parse the data:

:g/td title/ exec 'norm f"l"q3yW/<.td><.tr>' . "\<CR>f>a<td>\<Esc>" . 'qp' . "a</td>\<Esc>"

but it needs some work.

Est. 4-6h

Archive.zip
Archive2.zip

Support for XAGUSD

When testing XAGUSD like:

./run_backtest.sh -I Server=MetaQuotes-Demo -v -x -e MACD -y 2015 -m 1 -p XAGUSD -D5 -P M1

the FXT file is zeroed.

Related: #89

Enhance colors and add text on gif image

The goal is to replace existing colors and add custom text into the given gif image.

Testing:

  1. Place the gif image into the cloned repository.
  2. Run: ./scripts/eval.sh enhance_gif *.gif

The enhanced image should be modified as described below.

Tasks

Extend enhance_gif() from scripts/.initrc (dev branch) in order to:

  • - negate the image (this is already done)

  • - replace pink with blue, yellow with green

  • - add 3 lines of custom static text (later to be changed) below Balance/Equity line (ideally with similar font), e.g.

    Symbol                    EURUSD (Euro vs US Dollar)
    Model                     Every tick (the most precise method based on all available least timeframes)
    Bars in test       368715 Ticks modelled               74312557 Modelling quality                 24.99%
    

Est. 2-3h

cp: cannot create regular file: mt4-tester.ini: No such file or directory

vagrant@vagrant:~$ /vagrant/scripts/run_backtest.sh -v -e MACD -y 2014 -m 1 -C -R -M4.0.0.971
Copying ini files...
'/vagrant/conf/mt4-tester.ini' -> '/home/vagrant/.wine/drive_c/users/vagrant/Application Data/MetaQuotes/WebInstall/mt4clw/config/mt4-tester.ini'
cp: cannot create regular file '/home/vagrant/.wine/drive_c/users/vagrant/Application Data/MetaQuotes/WebInstall/mt4clw/config/mt4-tester.ini': No such file or directory
wineserver is /usr/bin/wineserver
Exiting /vagrant/scripts/run_backtest.sh with 1

Est. 1-3h

winetricks mt4 hangs

The following command:

curl https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks | bash -x /dev/stdin mt4

hangs on Linux.

E.g.

$ DISPLAY=:0.0 ./winetricks mt4
Using winetricks 20160425 - sha1sum: 0d572083442ec7b1375999e81f9f042f5f427a3c with wine-1.6.2
Executing w_do_call mt4
Executing load_mt4
------------------------------------------------------
Working around wine bug 7156 -- Meta Trader 4 needs wingdings.ttf, installing opensymbol
------------------------------------------------------
Executing w_do_call opensymbol
opensymbol already installed, skipping
Executing wine y:\ahk\AutoHotkey.exe C:\windows\Temp\_mt4\tmp.ahk
wine: cannot find L"C:\\windows\\system32\\winebrowser.exe"

^C

Specify deposit and spread for the backtest.

When running scripts/run_backtest.sh, deposit can be specified by -d parameter and spread by -s.

Deposit and spread should be defined in ini file (either in terminal.ini or EA ini), but it doesn't seems work.

Build: 95101025 (deposit = 2000, spread 10), but only deposit change works.

Try changing that option either in terminal ini or appropriate EA ini file, so the test can recognise that value.

Apply spread change in FXT file.

It seems changing Spread in terminal and tester ini files is not enough, as we need to apply that change also in FXT file at offset 0xFC. See: Converting to FXT.
We need function that will change that and to be used with -s.

Note that all values are in little endian format, meaning that if you have a value that exceeds one byte you have to fill in the bytes to its right. For instance, if you want to write 300 in the file you will have to write it as 2C 01.

Test for reading and checking symgroups.raw

Complete the test file to verify whether the file is valid.

File: tests/TestSymbolsRaw.mq4

Testing:

./scripts/run_backtest.sh -v -e TestSymbolsRaw

On Windows, use Vagrant and run: vagrant up first and run above inside the VM.

Est. 2-4h

Ticks are quadrupled when data files are not read-only.

When running test without setting read-only permission (-R), ticks are quadrupled (FXT).

Original (whole 2014 year):

Bars in test        371463 Ticks modelled               16999067 Modelling quality                    n/a

After FXT rebuild:

Bars in test       368715 Ticks modelled               74312557 Modelling quality                 24.99%

Example test with read-only (tick number is correct):

./scripts/run_backtest.sh -v -e MACD -y 2014 -m 1 -C -R
Bars in test               371463 Ticks modelled                           16999067 Modelling quality                             n/a

Example test (tick number is incorrect, however it's just for 1 month):

./scripts/run_backtest.sh -v -e MACD -y 2014 -m 1 -C
Bars in test                28787 Ticks modelled                            6474180 Modelling quality                          24.92%

Expected behavior of the script is to not quadruple the tick data. This can be error in the FXT file which was incorrectly converted.

I believe it works correctly when you're using standard fxt tick data when created a demo account, so the data is fetched from the demo server, then I believe it's fine. Not when we're using our custom generated files.

Use read_mt_formats.py to read ticks from the file why they're quadrupled.

Possible fix can be in the converter script: convert_csv_to_mt.py where you can re-generate FXT tick data and replace the existing EURUSD0_1.fxt file. The existing files are downloaded from here. You can see here the example how to convert the files.

Please work on the dev branch. If you don't have Linux/OSX, use VM (vagrant up).

Note: There is a lot of debugging or rather troubleshooting, so this task is only for experienced users and it may be very challenging. It's good that you can have a try before in order to understand the problem, otherwise you may not complete it.

P.S. I'm happy to answer any questions, give instruction how to convert the data or help to deal with any errors with scripts, so you can focus on the task.

Estimated time: 8-16h for experienced person.

Testing XAGUSD

Currently when testing with default server for XAGUSD it fails, e.g.

./run_backtest.sh -v -x -e MACD -y 2015 -m 1 -p XAGUSD -D5 -P M1

This may work with -I Server=MetaQuotes-Demo.

Goal is to find method for testing XAGUSD using default/off-line settings.

Install MT4 via winetricks.

The goal is to install MT4 platform using winetricks on different Linux environments (such as CI).
Currently it stuck. It works on some Linux distributions, but not on Travis CI. This should work for Travis CI.

Branch: mt4

Failing build: #137444101
Install script (main code): scripts/install_mt4.sh (called from run_backtest.sh with -M4 parameter)

Similar configuration with xdotool works fine in master (install_mt4-xdot.sh), but the goal is to achieve the same, but using winetricks only.

Note:

  • You may use VM (vagrant up) to test it (but possibly it'll work fine, but not in CI).
  • See: How to reproduce a travis-ci build environment for debugging
  • The common issue is that the installer is stuck at the proxy page, because it can't access HTTPS pages, and this is usually is fixed by these two methods:
    • Patching libgnutls for SSL/HTTPS fix (secur32_fix.sh), but it doesn't work in this case.
    • Installation of winhttp to access provide support for HTTPS pages, but it doesn't work in this case.

You may fork the repository and configure Travis CI running on your fork to test whether it works and fix it.

codemil$80

Write script to run optimization tests in VM.

For each test.ini we need to run file with .rules.

The goal is to run optimization tests based on YAML configuration, then propose changes with better optimized settings by sending a pull request.

  • write Python script to parse YAML file (e.g. optimizer.yml) passed from 2st argument

    ./run_optimizer.py -d deposit -s spread -b dukascopy -y `optimizer.yml` -f `EA31337-foo.set` -D dest/
    
    • default values: -d 2000 -s 30, mandatory parameters: -y, -f
    • given YAML file, for each main mapping section prepare the test data which is:
      • load and read SET file from the 3nd argument
      • write function to read and change settings in-place in SET file based on YAML rules which is:
        • disable given EA options in Settings based on values in Disable array
        • enable given EA options in Settings based on values in Enable array
        • if entry key is not Disable or Enable, set value for specific option name (e.g. LotSize)
        • if wildcard is specified, change value of all matching options (e.g. *_TrailingStopMethod: 0)
        • make sure it's executed in order
      • write function to change settings in-place in SET file based on YAML which is:
        • for each entry key starting with Test-, load entries into optimization SET file
        • given start, step, end, set appropriate values in SET file
        • after optimization test is run, go to the next test (within the same section) if present
      • after main section is finished, go to the next one (keeping the previous values)
    • load pair, deposit, spread values from for parameters and set into appropriate ini file
    • given SET file with prepared test data execute (e.g. run_optimizer.sh)
    • script should be configured to run from VM
  • write run_optimizer.sh (or reuse run_backtest.sh if possible) to run platform with given SET file

    • configure terminal.ini with appropriate settings for given optimization test
    • load year, deposit, spread and source of backtest data from the command line
    • run optimization test using platform under VM with given settings
      • Use: Genetic algorithm
      • Optimized parameter: Balance
      • Make placeholder for Limitation rules
    • save results into pre-configured destination folder
  • pass back the result into Python script then analyse and parse the data

    • save results into pre-configured destination folder
    • read results and update in-place SET file with optimized settings
  • after each test is completed, commit changes into local git repository with given new optimized settings:

    • each commit should have the following dynamic message:

      $TestExpert: $YML-SectionName: $YYYY-$mm-$dd - $YYYY-$mm-$dd, $TestSymbol $TestPeriod, Deposit: $$dep, Spread: $spread (Time: $TimeInMin min)

  • after each test is completed, push change into remote branch with given RSA key

    • branch name: $TestExpert-$pair-$deposit-$spread
  • after all tests are completed, generate pull request for that branch

Test for reading and checking HST header.

Complete the test file to verify that HST header is valid.

File: tests/TestHSTHeader.mq4

Testing:

./scripts/run_backtest.sh -v -e TestHSTHeader

On Windows, use Vagrant and run: vagrant up first and run above inside VM.

Est. 2-4h

vagrant: unrecognized option

E.g.

vagrant global-status --prune
/opt/vagrant/embedded/gems/gems/vagrant-1.8.1/bin/vagrant: unrecognized option `--prune'

Check:

  rescue
# @todo: Correct an invalid option error.

Test for reading and checking FXT header.

Complete the test file to verify that FXT is valid.

File: tests/TestFXTHeader.mq4
Branch: ci

Testing:

./scripts/run_backtest.sh -v -e TestFXTHeader -p EURUSD -y 2014 -m1

On Windows, use Vagrant and run: vagrant up first and run above inside VM.

See the docs page: https://www.mql5.com/en/articles/1540

Currently there is an error:

TestFXTHeader EURUSD,M1: Invalid file handle

It seems CreateFileW works randomly and when it work, then it fails on FileSeek which returns 5008 error.

Est. 2-8h

Various errors when installing the thing...

Potential duplicate #40

vagrant up
vagrant ssh
/vagrant/scripts/install_mt4.sh
wine "$(find ~/.wine -name terminal.exe)"
vagrant@vagrant:~$ /vagrant/scripts/install_mt4.sh
wget is /usr/bin/wget
xdotool is /usr/bin/xdotool
xwininfo is /usr/bin/xwininfo
wine is /usr/bin/wine
Downloading MT4 installer...
--2016-01-31 13:29:07--  https://download.mql5.com/cdn/web/metaquotes.software.corp/mt4/mt4setup.exe
Resolving download.mql5.com (download.mql5.com)... 78.140.180.43, 23.81.66.91, 78.140.180.43, ...
Connecting to download.mql5.com (download.mql5.com)|78.140.180.43|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 566640 (553K) [application/exe]
Saving to: โ€˜/opt/mt4setup.exeโ€™

mt4setup.exe       100%[==================>] 553.36K  1.73MB/s   in 0.3s

2016-01-31 13:29:08 (1.73 MB/s) - โ€˜/opt/mt4setup.exeโ€™ saved [566640/566640]

Starting MT4 Setup in Wine...
Waiting for Wine to initialize...
wine: created the configuration directory '/home/vagrant/.wine'
err:ole:marshal_object couldn't get IPSFactory buffer for interface {00000131-0000-0000-c000-000000000046}
err:ole:marshal_object couldn't get IPSFactory buffer for interface {6d5140c1-7436-11ce-8034-00aa006009fa}
err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hres=0x80040155
err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, 80040155
err:ole:get_local_server_stream Failed: 80040155
err:ole:marshal_object couldn't get IPSFactory buffer for interface {00000131-0000-0000-c000-000000000046}
err:ole:marshal_object couldn't get IPSFactory buffer for interface {6d5140c1-7436-11ce-8034-00aa006009fa}
err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hres=0x80040155
err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, 80040155
err:ole:get_local_server_stream Failed: 80040155
wine: configuration in '/home/vagrant/.wine' has been updated.
Sending installer keystrokes...
err:winhttp:netconn_secure_connect send failed
Waiting for installer to finish...

xwininfo: Window id: 0x800001 "MetaTrader 4 Setup (32 bit)"

  Root window id: 0x12e (the root window) (has no name)
  Parent window id: 0x12e (the root window) (has no name)
     0 children.

14621 mt4setup.exe
14621 mt4setup.exe
14621 mt4setup.exe
14621 mt4setup.exe
14621 mt4setup.exe
14621 mt4setup.exe
14621 mt4setup.exe
14621 mt4setup.exe
Waiting for MT4 platform to start...
err:toolbar:ToolbarWindowProc unknown msg 0465 wp=00000000 lp=0033ecc8
err:toolbar:ToolbarWindowProc unknown msg 0466 wp=00000000 lp=0033ecc8
err:toolbar:ToolbarWindowProc unknown msg 0465 wp=00000000 lp=0033ecc8
err:toolbar:ToolbarWindowProc unknown msg 0466 wp=00000000 lp=0033ecc8
err:toolbar:ToolbarWindowProc unknown msg 0465 wp=00000000 lp=0033ecc8
err:toolbar:ToolbarWindowProc unknown msg 0466 wp=00000000 lp=0033ecc8
err:toolbar:ToolbarWindowProc unknown msg 0465 wp=00000000 lp=0033ecc8
err:toolbar:ToolbarWindowProc unknown msg 0466 wp=00000000 lp=0033ecc8
Closing application...
/vagrant/scripts/install_mt4.sh done.
Exiting /vagrant/scripts/install_mt4.sh with 0

Test for reading and checking symbols.raw

Complete the test file to verify whether the file is valid.

File: tests/TestSymgroupsRaw.mq4

Testing:

./scripts/run_backtest.sh -v -e TestSymgroupsRaw

On Windows, use Vagrant and run: vagrant up first and run above inside the VM.

Est. 2-4h

run_test.sh should run the backtest and generate report file

Goal:

  • scripts/run_test.sh in VM should run MT4 platform headlessly in order to generate report file (html) for further parsing

Steps to run:

  1. Run: vagrant up - to initialize and provision VM (scripts/provision.sh is automatically called)
  2. Run: vagrant ssh - to log-in to VM.
  3. Run: /vagrant/scripts/run_test.sh.

Expected results: after 3. is run, platform should run by performing backtest testing and html report file is generated.

Sub-tasks:

  • possibly ~/.wine configuration needs to be generated on first run during provisioning, when running terminal for the first time, the following message is shown:

    wine: created the configuration directory '/home/vagrant/.wine'

    and the popup is shown about Mono&Gecko package not installed, despite it has been installed during provision.

Hints:

  • if X is configured on local, X11 forwarding from VM would show the apps on the local machine (on OS X works out-of-box)
  • when terminal window is open and test is not performed, check Journal console
  • if test is not run, consider checking logs/ or tester/logs for log files (which should be printed on the console anyway)

See MT4 User Guide (pages 166 and further) for more details about launching the terminal with predefined settings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.