Closed stefek99 closed 8 years ago
It's depending how you want to run it.
In VM (vagrant ssh
) after install (/vagrant/scripts/install_mt4.sh
), to run just terminal, try:
wine "$(find ~ -name terminal.exe)"
which should run successfully the terminal with GUI interface on your local when you've XQuartz installed on OS X (or by default in Linux) since there is X11 forwarding over SSH connection enabled in Vagrantfile
which makes DISPLAY
set to localhost:10.0
by default.
If it's for backtest test only, use provided run_backtest.sh
script. If it's VM, you need to provision your machine first (vagrant up
) which will run Xvfb
and export DISPLAY
, then run the script inside the machine (vagrant ssh
). In addition if X is still not running, the following line in .configrc
make sure that it'll re-run:
export DISPLAY=:0.0 # Select screen 0.
xdpyinfo -display $DISPLAY > /dev/null || Xvfb $DISPLAY -screen 0 1024x768x16 &
Here is sample command to run it inside VM on your host shell:
vagrant ssh -c "/vagrant/scripts/run_backtest.sh -c USD -e EA31337-Lite -d 2000 -p EURUSD -y 2014 -s 10 -b DS -D /vagrant/files"
in case your EA is placed somewhere within your VM folder (e.g. files/
).
If you're trying to run terminal on your host, then you need to provide DISPLAY
yourself by pointing to your screen. If you're not using X virtual framebuffer, but standard X/XQuartz desktop with GUI terminal, I think this should work automatically.
Thank you for explanation.
On second thoughts I may actually try to run run_backtest.sh
without the use of VM...
(I have a second-hand Windows laptop specifically to run MetaTrader)
I hope that it will be a smooth process, otherwise I'll be on my own!
(I'm probably the only one here on Windows)
Added run_terminal.sh
script for convenience into dev
branch, so you can run it in VM by:
/vagrant/scripts/run_terminal.sh
which should run terminal with GUI when X11 forwarding over SSH connection is working correctly. Or run run_terminal.sh
locally (should work as well).
I got latest, switched to dev
branch and run the run_terminal.sh
script...
Nothing happens.
I think I should use existing scripts and run Meta Trader natively, on the other hand it will cause further incompatibilities down the line.
(still undecided)
Here is what I've got when I tried /vagrant/scripts/run_backtest.sh -c -e EA31337-Lite-Backtest -d 2000 -p EURUSD -y 2014 -s 10 -b N5 -D /vagrant/files
ALSA
errors are meaningless (some sound driver), this '1234': connect failed [No connection]
is more worrying...
git is /usr/bin/git
ex is /usr/bin/ex
Checking platform dependencies...
Getting 'TestExpert' from mt4-tester.ini: Moving Average
Setting '^currency' to '-e' in Moving Average.ini
Cleaning previous test data...
Printing logs...
==> /home/vagrant/.wine/drive_c/Program Files (x86)/MetaTrader 4/tester/logs/terminal.log <==
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:768:(parse_card) cannot find card '0'
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
real 0m22.061s
user 0m2.208s
sys 0m3.176s
==> /home/vagrant/.wine/drive_c/Program Files (x86)/MetaTrader 4/tester/logs/20160210.log <==
0 09:45:03.122 Expert Moving Average EURUSD,M1: loaded successfully
0 09:45:03.124 Tester: start with configuration file
3 09:45:03.861 TestGenerator: file "C:\Program Files (x86)\MetaTrader 4\tester\history\EURUSD1_0.fxt" is read-only
3 09:45:03.861 TestGenerator: symbol EURUSD period 1 model 0 from 2014.01.01 to 2014.12.31
3 09:45:03.862 Tester: exchange rate cannot be calculated
3 09:45:03.862 Tester: margin exchange rate cannot be calculated
2 09:45:03 2014.01.01 00:00 Moving Average inputs: Lots=0.1; MaximumRisk=0.02; DecreaseFactor=3; MovingPeriod=12; MovingShift=6;
2 09:45:04 2014.01.03 21:59 Moving Average EURUSD,M1: open #1 sell 0.20 EURUSD at 1.35870 ok
1 09:45:04 2014.01.03 21:59 Moving Average: tester cannot calculate prices
2 09:45:04 2014.01.03 21:59 Tester: order #1 is closed
0 09:45:04.354 EURUSD,M1: 144409 tick events (371463 bars, 16999067 bar states) processed in 0:00:00.464 (total time 0:00:00.493)
==> /home/vagrant/.wine/drive_c/Program Files (x86)/MetaTrader 4/MQL4/Logs/20160210.log <==
0 09:44:51.035 Compiling 'Parabolic'
0 09:44:51.035 Compiling 'Custom Moving Averages'
0 09:44:51.035 Compiling 'Bears'
0 09:44:51.035 Compiling 'RSI'
0 09:44:51.035 Compiling 'Awesome'
0 09:44:51.035 Compiling 'Momentum'
0 09:44:51.035 Compiling 'iExposure'
0 09:44:51.035 Compiling 'Accumulation'
0 09:44:51.035 Compiling 'Accelerator'
0 09:44:51.035 Compiling 'Stochastic'
0 09:44:51.035 Compiling 'ZigZag'
0 09:44:51.035 Compiling 'Bulls'
0 09:44:51.035 Compiling 'CCI'
0 09:44:51.035 Compiling 'MACD'
0 09:44:51.039 Compiling 'SimplePanel'
0 09:44:56.968 Compiling 'PeriodConverter'
0 09:44:56.972 Compiling 'PipeClient'
0 09:44:56.972 Compiling 'PipeClientPure'
0 09:44:56.974 Compiling 'DLLSampleTester'
0 09:44:59.199 Compiling 'stdlib'
==> /home/vagrant/.wine/drive_c/Program Files (x86)/MetaTrader 4/logs/metaeditor.log <==
āā
==> /home/vagrant/.wine/drive_c/Program Files (x86)/MetaTrader 4/logs/metaeditor_prev.log <==
āā
==> /home/vagrant/.wine/drive_c/Program Files (x86)/MetaTrader 4/logs/20160210.log <==
0 09:44:48.124 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Indicators/Parabolic.mq4 updated
0 09:44:48.124 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Indicators/RSI.mq4 updated
0 09:44:48.124 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Indicators/Stochastic.mq4 updated
0 09:44:48.125 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Indicators/ZigZag.mq4 updated
0 09:44:48.125 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Libraries/stdlib.mq4 updated
0 09:44:48.126 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Scripts/Examples/DLL/DLLSample.cpp updated
0 09:44:48.126 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Scripts/Examples/DLL/DLLSample.def updated
0 09:44:48.126 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Scripts/Examples/DLL/DLLSampleTester.mq4 updated
0 09:44:48.127 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Scripts/Examples/DLL/Libraries/DLLSample.dll updated
0 09:44:48.128 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Scripts/Examples/Pipes/PipeClient.mq4 updated
0 09:44:48.128 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Scripts/Examples/Pipes/PipeClientPure.mq4 updated
0 09:44:48.129 LiveUpdate: C:\Program Files (x86)\MetaTrader 4\MQL4/Scripts/PeriodConverter.mq4 updated
0 09:44:48.129 LiveUpdate: update C:\Program Files (x86)\MetaTrader 4\MQL4 folder finished
0 09:44:48.518 MetaTrader 4 build 950 started (MetaQuotes Software Corp.)
0 09:44:48.523 Microsoft Windows XP (x64 based PC), IE 09.00, 2 x Intel Pentium 4 2.40GHz, RAM: 1728 / 2000 Mb, HDD: 35032 / 39731 Mb, GMT+00:0 0
0 09:44:48.523 Data Folder: C:\Program Files (x86)\MetaTrader 4
0 09:44:48.943 Sources recompilation started
0 09:45:00.919 Sources recompilation finished (28 compiled in 11977 msec)
0 09:45:00.921 Started with configuration file 'config/mt4-tester.ini'
1 09:45:06.251 '1234': connect failed [No connection]
TEST failed.
/vagrant/scripts/run_backtest.sh done.
Exiting /vagrant/scripts/run_backtest.sh with 1
The test is ran fine, but there are few issues.
First -e EA31337-Lite-Backtest
is looking for EA ex4 file, but it's not there, so it's doing fallback to default Moving Average.
Second issue is that -c
expects base currency value, e.g. -c USD
, currently you're setting -c
(currency) into invalid value of -e
(as per Setting '^currency' to '-e'
).
Third issue is Tester: exchange rate cannot be calculated
, which I see for the first time, so maybe your backtest data is not correct, I'm not sure.
.Previously:
/vagrant/scripts/run_backtest.sh -c -e EA31337-Lite-Backtest -d 2000 -p EURUSD -y 2014 -s 10 -b N5 -D /vagrant/files
-c
and no currency specified, obvious copy and paste mistake.
So I tried a new version:
/vagrant/scripts/run_backtest.sh -c USD -e EA31337-Lite-Backtest -d 2000 -p EURUSD -y 2014 -s 10 -b N5 -D /vagrant/files
This time output is much shorter:
git is /usr/bin/git
ex is /usr/bin/ex
xdpyinfo is /usr/bin/xdpyinfo
Checking platform dependencies...
ERROR: Exiting /vagrant/scripts/run_backtest.sh with 1
218 onerror /vagrant/scripts/.configrc
124 main /vagrant/scripts/run_backtest.sh
Exiting /vagrant/scripts/run_backtest.sh with 1
The first one still works...
I would never imagine that will run Windows program on Ubuntu VM via Vagrant nad wine... It feels complicated to me (not an expert in any of these technologies).
I'll try to get the essence of the .sh scripts and run them natively on Windows... I hope that this will save me frustrations.
(it is never fun when "hello world" quickstart tutorial causes so many issues to begin with)
It failed on:
124 main /vagrant/scripts/run_backtest.sh
which is:
[ -f "$EA_PATH" ]
so basically the EA path is not found (-e
). Replace EA31337-Lite-Backtest
with path to existing file, such as MACD
or any other EA which exists within your VM folder.
I've added human readable error when EA file is not found.
Here is the rule which finding it:
EA_PATH="$(find "$ROOT" '(' -name "*$EA_NAME*.ex4" -o -name "*$EA_NAME*.ex5" ')' -print -quit)"
which is basically scanning your VM (/vagrant
) folder for any file which consist given name (either with ex4
or ex5
extension).
When running command:
wine "$(find ~/.wine -name terminal.exe)"
I'm getting the following output:
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: