|
1 | 1 | """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 | | -""" |
4 | 2 |
|
| 3 | +This Expert Advisor is designed for WING21 futures, using Fibonacci retracement levels to |
| 4 | +determine entry and exit points. |
| 5 | +""" |
5 | 6 | import MetaTrader5 as Mt5 |
6 | 7 | import numpy as np |
7 | 8 | from include.rates import Rates |
|
81 | 82 | trade.take_profit = zone_618 |
82 | 83 |
|
83 | 84 | 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 |
87 | 87 |
|
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 |
91 | 90 |
|
92 | 91 | trade.emergency_stop_loss = trade.stop_loss |
93 | 92 | trade.emergency_take_profit = trade.take_profit |
|
98 | 97 | if trade.days_end(): |
99 | 98 | trade.close_position("End of the trading day reached.") |
100 | 99 | break |
101 | | - |
102 | | -print("Finishing the program.") |
103 | | -print("Program finished.") |
0 commit comments