Skip to content

Commit 76b857d

Browse files
committed
Batch of changes
1 parent bd5a323 commit 76b857d

File tree

6 files changed

+25
-29
lines changed

6 files changed

+25
-29
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test MetaTrader5 Initialization
1+
name: Test | Test MetaTrader5 Initialization
22

33
on:
44
push:
@@ -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) {
@@ -70,9 +70,9 @@ jobs:
7070
7171
# Save script to temporary file
7272
$script | Out-File -FilePath "test_mt5.py" -Encoding utf8
73-
73+
7474
# Run the test
7575
python test_mt5.py
76-
76+
7777
# Always continue build
7878
exit 0
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
"""FiMathe strategy examples for MetaTrader 5.
2+
3+
This package contains examples of Expert Advisors using Fibonacci retracement levels.
4+
"""

examples_of_expert_advisor/fimathe/eurusd_fimathe.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
"""EURUSD FiMathe Expert Advisor for MetaTrader 5.
2-
This Expert Advisor uses Fibonacci retracement levels to determine entry and exit points.
31
"""
2+
EURUSD FiMathe Expert Advisor for MetaTrader 5.
43
4+
This Expert Advisor uses Fibonacci retracement levels to determine entry and exit points.
5+
"""
56
import MetaTrader5 as Mt5
67
import numpy as np
78
from include.rates import Rates
@@ -72,13 +73,11 @@
7273
trade.take_profit = zone_618
7374

7475
if len(Mt5.positions_get(symbol=trade.symbol)) == 1:
75-
if Mt5.positions_get(symbol=trade.symbol)[0].type == 0: # if Buy
76-
if tick.last > Mt5.positions_get(symbol=trade.symbol)[0].price_open + zone_236:
77-
trade.stop_loss = trade.sl_tp_steps
76+
if Mt5.positions_get(symbol=trade.symbol)[0].type == 0 and tick.last > Mt5.positions_get(symbol=trade.symbol)[0].price_open + zone_236: # if Buy
77+
trade.stop_loss = trade.sl_tp_steps
7878

79-
elif Mt5.positions_get(symbol=trade.symbol)[0].type == 1: # if Sell
80-
if tick.last < Mt5.positions_get(symbol=trade.symbol)[0].price_open - zone_236:
81-
trade.stop_loss = trade.sl_tp_steps
79+
elif Mt5.positions_get(symbol=trade.symbol)[0].type == 1 and tick.last < Mt5.positions_get(symbol=trade.symbol)[0].price_open - zone_236: # if Sell
80+
trade.stop_loss = trade.sl_tp_steps
8281

8382
trade.emergency_stop_loss = trade.stop_loss + zone_236
8483
trade.emergency_take_profit = trade.take_profit + zone_236
@@ -89,6 +88,3 @@
8988
if trade.days_end():
9089
trade.close_position("End of the trading day reached.")
9190
break
92-
93-
print("Finishing the program.")
94-
print("Program finished.")

examples_of_expert_advisor/fimathe/win_fimathe.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""WIN FiMathe Expert Advisor for MetaTrader 5.
2-
This Expert Advisor is designed for WING21 futures, using Fibonacci retracement levels to determine entry and exit points.
3-
"""
42
3+
This Expert Advisor is designed for WING21 futures, using Fibonacci retracement levels to
4+
determine entry and exit points.
5+
"""
56
import MetaTrader5 as Mt5
67
import numpy as np
78
from include.rates import Rates
@@ -81,13 +82,11 @@
8182
trade.take_profit = zone_618
8283

8384
if len(Mt5.positions_get(symbol=trade.symbol)) == 1:
84-
if Mt5.positions_get(symbol=trade.symbol)[0].type == 0: # if Buy
85-
if tick.last > Mt5.positions_get(symbol=trade.symbol)[0].price_open + zone_236:
86-
trade.stop_loss = trade.sl_tp_steps
85+
if Mt5.positions_get(symbol=trade.symbol)[0].type == 0 and tick.last > Mt5.positions_get(symbol=trade.symbol)[0].price_open + zone_236: # if Buy
86+
trade.stop_loss = trade.sl_tp_steps
8787

88-
elif Mt5.positions_get(symbol=trade.symbol)[0].type == 1: # if Sell
89-
if tick.last < Mt5.positions_get(symbol=trade.symbol)[0].price_open - zone_236:
90-
trade.stop_loss = trade.sl_tp_steps
88+
elif Mt5.positions_get(symbol=trade.symbol)[0].type == 1 and tick.last < Mt5.positions_get(symbol=trade.symbol)[0].price_open - zone_236: # if Sell
89+
trade.stop_loss = trade.sl_tp_steps
9190

9291
trade.emergency_stop_loss = trade.stop_loss
9392
trade.emergency_take_profit = trade.take_profit
@@ -98,6 +97,3 @@
9897
if trade.days_end():
9998
trade.close_position("End of the trading day reached.")
10099
break
101-
102-
print("Finishing the program.")
103-
print("Program finished.")

mqpy/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
create Expert Advisors and implement trading strategies in Python.
55
"""
66

7-
from .version import __version__
7+
from .version import __version__ as __version__

mqpy/indicator_connector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
""" Python integration module for technical indicators.
1+
"""Python integration module for technical indicators.
22
33
This module provides a bridge between Python and MT5 indicators through socket connections.
44
"""

0 commit comments

Comments
 (0)