Skip to content

Commit c0e78a8

Browse files
committed
pre-commit
1 parent 74325c8 commit c0e78a8

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

.github/workflows/test-metatrader5-integration.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ jobs:
2222
run: |
2323
# Download MT5 setup
2424
Invoke-WebRequest -Uri "https://download.mql5.com/cdn/web/metaquotes.software.corp/mt5/mt5setup.exe" -OutFile mt5setup.exe
25-
25+
2626
# Install MT5 silently
2727
Start-Process -FilePath .\mt5setup.exe -ArgumentList "/auto" -Wait
28-
28+
2929
# Verify installation
3030
$mtPath = "C:\Program Files\MetaTrader 5\terminal64.exe"
3131
if (Test-Path $mtPath) {
@@ -45,17 +45,17 @@ jobs:
4545
# Kill any existing MT5 instances
4646
taskkill /F /IM terminal64.exe 2>$null
4747
Start-Sleep -Seconds 3
48-
48+
4949
# Start MT5 with the /desktop parameter as suggested in MQL5 forum
5050
$process = Start-Process -FilePath "C:\Program Files\MetaTrader 5\terminal64.exe" -ArgumentList "/portable", "/desktop" -PassThru
51-
$pid = $process.Id
52-
Write-Host "Started MetaTrader 5 terminal with PID $pid using /desktop parameter"
51+
$processId = $process.Id
52+
Write-Host "Started MetaTrader 5 terminal with PID $processId using /desktop parameter"
5353
Start-Sleep -Seconds 30
5454
5555
- name: Test MT5 Initialization
5656
run: |
5757
# Python script for testing MT5 initialization
58-
$script = @"
58+
$script = @'
5959
import sys
6060
import time
6161
import MetaTrader5 as mt5
@@ -76,21 +76,21 @@ if result:
7676
if terminal_info:
7777
print(f"Terminal info - Path: {terminal_info.path}")
7878
print(f"Terminal connected: {getattr(terminal_info, 'connected', 'N/A')}")
79-
79+
8080
# Shut down properly
8181
mt5.shutdown()
8282
else:
8383
print("Failed to initialize MetaTrader 5")
8484

8585
# Always exit with success for CI
8686
sys.exit(0)
87-
"@
87+
'@
8888
8989
# Save script to temporary file
9090
$script | Out-File -FilePath "test_mt5.py" -Encoding utf8
91-
91+
9292
# Run the test
9393
python test_mt5.py
94-
94+
9595
# Always continue build
9696
exit 0

example.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Example trading strategy using the MQL5-Python integration.
2+
23
This example demonstrates a Moving Average Crossover strategy.
34
"""
45

@@ -52,6 +53,3 @@
5253
if trade.days_end():
5354
trade.close_position("End of the trading day reached.")
5455
break
55-
56-
print("Finishing the program.")
57-
print("Program finished.")
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""Expert Advisor examples for MetaTrader 5.
2+
3+
This package contains example implementations of various trading strategies.
4+
"""

examples_of_expert_advisor/example_sockets_connection.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Example Expert Advisor demonstrating socket connections with MetaTrader 5.
2+
23
This example uses stochastic oscillator and moving average indicators to generate trading signals.
34
"""
45

@@ -50,12 +51,7 @@
5051

5152
# It uses "try" and catch because sometimes it returns None.
5253
try:
53-
# When in doubt how to handle the indicator, print it, it returns a Dictionary.
54-
# logger.info(moving_average)
55-
# It prints:
56-
# {'symbol': 'PETR4', 'time_frame': 1, 'period': 50, 'start_position': 0, 'method': 0,
57-
# 'applied_price': 0, 'moving_average_result': 23.103}
58-
54+
# When in doubt how to handle the indicator, it returns a Dictionary.
5955
k_now = stochastic_now["k_result"]
6056
d_now = stochastic_now["d_result"]
6157

scripts/build_docs.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)