Skip to content

test different strategy #50

test different strategy

test different strategy #50

name: MetaTrader5 CI Headless Setup
on: [push]
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Download MetaTrader5 Installer
run: |
Invoke-WebRequest `
-Uri "https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe" `
-OutFile "mt5setup.exe"
shell: pwsh
- name: Install MetaTrader5 silently
run: |
Start-Process -FilePath ".\mt5setup.exe" -ArgumentList "/silent" -Wait
shell: powershell
- name: Kill any existing MT5 processes
run: |
Get-Process terminal64 -ErrorAction SilentlyContinue | Stop-Process -Force
shell: powershell
- name: Launch MetaTrader5 Terminal in portable mode
run: |
Start-Process "C:\Program Files\MetaTrader 5\terminal64.exe" -ArgumentList "/portable"
Start-Sleep -Seconds 15
shell: powershell
- name: Install MetaTrader5 Python package
run: pip install MetaTrader5
- name: Run your Python script
run: |
python - << 'EOF'
import MetaTrader5 as mt5
if not mt5.initialize(path=r"C:/Program Files/MetaTrader 5/terminal64.exe", timeout=300000):
print("initialize() failed, error code:", mt5.last_error())
exit(1)
# Example: print account info
print(mt5.account_info())
mt5.shutdown()
EOF
shell: pwsh