Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to query current display settings for L"\\\\.\\DISPLAY1" #224

Open
missinglink opened this issue Jan 31, 2023 · 7 comments
Open

Failed to query current display settings for L"\\\\.\\DISPLAY1" #224

missinglink opened this issue Jan 31, 2023 · 7 comments

Comments

@missinglink
Copy link

Heya,

I'm having trouble running the example command from the README:

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

The pertinent section of the logs seems to be:

INFO: Compiling EA (MACD Sample.mq4)...
0048:err:explorer:initialize_display_settings Failed to query current display settings for L"\\\\.\\DISPLAY1".
0098:err:ntoskrnl:ZwLoadDriver failed to create driver L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\wineusb": c0000142
00ec:err:d3d:wined3d_adapter_init Failed to initialise output, hr 0x80070057.
INFO: Number of files compiled: 0

Full output: https://pastebin.com/JdBxx2k1

I'm running this on a MacOS host using Docker Desktop.

docker --version
Docker version 20.10.21, build baeda1f

Running the other example command docker run ea-tester run_backtest -e TestEnvelopes -v yeilds similar warnings related to the display:

INFO: Compiling EA (TestEnvelopes.mq4)...
0044:err:explorer:initialize_display_settings Failed to query current display settings for L"\\\\.\\DISPLAY1".
0098:err:ntoskrnl:ZwLoadDriver failed to create driver L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\wineusb": c0000142
00ec:err:d3d:wined3d_adapter_init Failed to initialise output, hr 0x80070057.
...
_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root

The VNC desktop is:      d521f7db45c9:0
PORT=5900
...
Xvfb killed (pid 373)
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
      after 13 requests (13 known processed) with 0 events remaining.

Full output: https://pastebin.com/QD0xskR6

The test report consists of all zeros, which I'm assuming is incorrect?

INFO: Printing test report (TestEnvelopes-Report.htm)...

                                                                               Strategy Tester Report
                                                                                   TestEnvelopes
                                                                                    (Build 1359)

                         Symbol                            EURUSD (Euro vs US Dollar)
                         Period                            30 Minutes (M30) 2019.01.04 00:00 - 2019.01.30 23:30 (2019.01.01 - 2019.01.31)
                         Model                             Every tick (the most precise method based on all available least timeframes)
                         Bars in test                 1013 Ticks modelled                         12141524 Modelling quality                        81.13%
                         Mismatched charts errors        0
                         Initial deposit          10000.00                                                 Spread                                       10
                         Total net profit             0.00 Gross profit                               0.00 Gross loss                                -0.00
                         Profit factor                     Expected payoff                            0.00
                         Absolute drawdown            0.00 Maximal drawdown                   0.00 (0.00%) Relative drawdown                  0.00% (0.00)
                         Total trades                    0 Short positions (won %)               0 (0.00%) Long positions (won %)                0 (0.00%)
                                                           Profit trades (% of total)            0 (0.00%) Loss trades (% of total)              0 (0.00%)
                                                   Largest profit trade                               0.00 loss trade                                -0.00
                                                   Average profit trade                               0.00 loss trade                                -0.00
                                                   Maximum consecutive wins (profit in money)     0 (0.00) consecutive losses (loss in money)    0 (-0.00)
                                                   Maximal consecutive profit (count of wins)     0.00 (0) consecutive loss (count of losses)    -0.00 (0)
                                                   Average consecutive wins                              0 consecutive losses                            0

Any ideas how I might resolve these errors 🙏 ?

@missinglink
Copy link
Author

missinglink commented Jan 31, 2023

This comment seems to be helpful but I still wasn't able to get it to work.
note: requires xquartz on MacOS.

Unrecognized option: host.docker.internal:0
use: X [:<display>] [option]
...
Fatal server error:
(EE) Unrecognized option: host.docker.internal:0
(EE)

31/01/2023 14:33:54 ***************************************
31/01/2023 14:33:54 *** XOpenDisplay failed (WAIThost.docker.internal:0)

*** x11vnc was unable to open the X DISPLAY: "WAIThost.docker.internal:0", it cannot continue.

@kenorb
Copy link
Member

kenorb commented Feb 1, 2023

The below errors are not so important, as I'm having them often, so they can be ignored and they shouldn't affect the run time in overall. I didn't look in too much details how to fix them.

0044:err:explorer:initialize_display_settings Failed to query current display settings for L"\\\\.\\DISPLAY1".
0098:err:ntoskrnl:ZwLoadDriver failed to create driver L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\wineusb": c0000142
00ec:err:d3d:wined3d_adapter_init Failed to initialise output, hr 0x80070057.
...
_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root

E.g. d3d one complaining about missing Direct3D libraries (I think), ntoskrnl about some driver, and .X11-unix about permission. I think each error can be search for how to fix it from the Wine perspective (if you really want to fix them). We're running Windows application in a virtual frame-buffer within container on Linux, so it's not even on the regular desktop, especially it's not native Windows (where it was written), so that could be one of many reasons.

@kenorb
Copy link
Member

kenorb commented Feb 1, 2023

The test report consists of all zeros, which I'm assuming is incorrect?

You're running TestEnvelopes script which is not doing any trading. It's written to test the indicator values which it prints correctly:

0	13:48:06.638	2019.01.04 00:00:00  TestEnvelopes EURUSD,M30: Testing values for Envelopes indicator...
0	13:48:06.638	2019.01.04 00:00:00  TestEnvelopes EURUSD,M30: Symbol            : EURUSD
0	13:48:06.638	2019.01.04 00:00:00  TestEnvelopes EURUSD,M30: Current timeframe : 0
0	13:48:06.638	2019.01.04 00:00:00  TestEnvelopes EURUSD,M30: Bid/Ask           : 1.139/1.14
0	13:48:06.639	2019.01.04 00:00:00  TestEnvelopes EURUSD,M30: Envelopes M1          : 1.13811/1.13925/1.14039 => CORRECT
0	13:48:06.639	2019.01.04 00:00:00  TestEnvelopes EURUSD,M30: Envelopes M5          : 1.13817/1.13931/1.14045 => CORRECT
0	13:48:06.639	2019.01.04 00:00:00  TestEnvelopes EURUSD,M30: Envelopes M15          : 1.13829/1.13943/1.14057 => CORRECT
0	13:48:06.639	2019.01.04 00:00:00  TestEnvelopes EURUSD,M30: Envelopes M30          : 1.13836/1.1395/1.14064 => CORRECT
0	13:48:08.717	2019.01.04 00:00:00  TestEnvelopes EURUSD,M30: Envelopes M60          : 1.13679/1.13793/1.13907 => CORRECT
0	13:48:08.717	2019.01.04 00:00:00  TestEnvelopes EURUSD,M30: Envelopes values are correct!

On success, it's returns exit code 0, on failure 1. This script is used for CI/CD to test for any regressions. So 0 trades is expected. Source code: https://github.com/EA31337/EA-Tester/blob/master/tests/TestEnvelopes.mq4

@kenorb
Copy link
Member

kenorb commented Feb 1, 2023

For run with MACD, it's either you need to increase the period (maybe it's not trading too often), or the EA is broken. MACD is the default one which comes from the platform, they're very basic EAs and usually broken.
To increase number of months (by default only 1st month is run due to run being slow, so you can find about these errors before), use: -m 1-12.

@kenorb
Copy link
Member

kenorb commented Feb 1, 2023

To test using EA31337 Advanced which should work better in terms of trading, try:

docker run ea31337/ea-tester run_backtest -y 2020 -m 1-12 -v -t -e https://github.com/EA31337/EA31337/releases/download/v2.011/EA31337-Advanced-v2.011.ex4

Note: 2021 year is also supported, 2022 needs to be yet released.

Or use EA31337 Libre, which is simpler EA, but still should trade fine:

-e https://github.com/EA31337/EA31337-Libre/releases/download/v1.011/EA31337-Libre-v1.011.ex4

@kenorb
Copy link
Member

kenorb commented Feb 1, 2023

Unrecognized option: host.docker.internal:0
use: X [:<display>] [option]
...
Fatal server error:
(EE) Unrecognized option: host.docker.internal:0
(EE)

31/01/2023 14:33:54 ***************************************
31/01/2023 14:33:54 *** XOpenDisplay failed (WAIThost.docker.internal:0)

*** x11vnc was unable to open the X DISPLAY: "WAIThost.docker.internal:0", it cannot continue.

This error it's something to do with x11vnc which is installed by default, so you can access the X11 screen. Probably x11vnc is using some syntax which doesn't work in in XQuartz.

To disable installation of x11vnc package during provisioning, you can specify PROVISION_VNC=0 for provision.sh.

To avoid VNC running during the backtest run, you need to make sure the process x11vnc isn't running. Here is relevant code: https://github.com/EA31337/EA-Tester/blob/v1.0.4/scripts/.funcs.cmds.inc.sh#L280
If the x11vnc process is found, it's running x11vnc with some options. So if you stop the VNC service, the script should ignore it.

@kenorb
Copy link
Member

kenorb commented Feb 1, 2023

INFO: Compiling EA (MACD Sample.mq4)...
...
(non-related Wine errors to ignore)
...
INFO: Number of files compiled: 0

I've looked again into your issue at pastebin, and your main error is actually (wrongly printed as info, because it's just printing number of compiled files):

Number of files compiled: 0

If you look at the stack trace at your pastebin output, it's:

847 main /opt/scripts/run_backtest.sh
ERROR: Exiting /opt/scripts/run_backtest.sh with 1

Which points to this line: https://github.com/EA31337/EA-Tester/blob/v1.0.4/scripts/run_backtest.sh#L847

[ "${compiled_no}" -gt 0 ]

So that means, for some reason the provided file (MACD Sample.mq4) couldn't be compiled properly. It's either due to white space (a less likely bug) or due to dependencies. MACD Sample is using some MQL libraries, and there is a chance they're not included properly, or maybe there are some compilation errors. Sometimes EA Tester have problems when source code file have complicated include dependencies pointing to different files. Unfortunately compilation errors aren't always shown on the screen, but they should be logged somewhere in the log file within the container (you can exec into running container and check manually via shell). The workaround to this is to provide already compiled file.

Useful tip: If you want to know exactly why the tester script failed, add -x for tracing (it'll print you each shell command on the screen).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants