@@ -40,16 +40,37 @@ jobs:
4040 python -m pip install --upgrade pip
4141 pip install MetaTrader5
4242
43+ - name : Setup virtual display
44+ run : |
45+ # Install Chocolatey if not already installed
46+ if (-not (Get-Command choco -ErrorAction SilentlyContinue)) {
47+ Set-ExecutionPolicy Bypass -Scope Process -Force
48+ [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
49+ Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
50+ }
51+
52+ # Install VcXsrv Windows X Server
53+ choco install vcxsrv -y
54+
55+ # Start VcXsrv in background
56+ Start-Process "C:\Program Files\VcXsrv\vcxsrv.exe" -ArgumentList "-multiwindow", "-ac", "-terminate", "-lesspointer", "-wgl", "-dpi auto"
57+
58+ # Set DISPLAY environment variable
59+ [Environment]::SetEnvironmentVariable("DISPLAY", "127.0.0.1:0.0", "Process")
60+
61+ Write-Host "Virtual display configured with DISPLAY=127.0.0.1:0.0"
62+ Start-Sleep -Seconds 5
63+
4364 - name : Run MT5 terminal with desktop parameter
4465 run : |
4566 # Kill any existing MT5 instances
4667 taskkill /F /IM terminal64.exe 2>$null
4768 Start-Sleep -Seconds 3
4869
49- # Start MT5 with the /desktop parameter as suggested in MQL5 forum
50- $process = Start-Process -FilePath "C:\Program Files\MetaTrader 5\terminal64.exe" -ArgumentList "/portable", "/desktop" -PassThru
70+ # Start MT5 with the /portable parameter
71+ $process = Start-Process -FilePath "C:\Program Files\MetaTrader 5\terminal64.exe" -ArgumentList "/portable" -PassThru
5172 $processId = $process.Id
52- Write-Host "Started MetaTrader 5 terminal with PID $processId using /desktop parameter "
73+ Write-Host "Started MetaTrader 5 terminal with PID $processId using virtual display "
5374 Start-Sleep -Seconds 30
5475
5576 - name : Test MT5 initialization
0 commit comments