Create Code (python - Mql5 API) to Place and Close orders

MQL5 Script Design Python

Lavoro terminato

Tempo di esecuzione 1 giorno
Feedback del dipendente
Toxic client. The work is completed by the arbiter.

Specifiche

Hi

The objective of this job is to create or fix the next code (Mql5 APY Python) and be able to place orders base on the next conditions:

if:

pre == 0 do nothing

pre == 1 open long

pre == 2 close long

pre == 3 open short

pre == 4 close short


The way to validate the job is to implement the code in a JupyterLab notebook runing in a vps with windows and see the results when changing the pre values


In the next link you can find and copy the entire code: https://controlc.com/63fc1b87


On the next lines the code that I been working on but has an error and do not close the the orders, it open the order but it do not close them.... 


####### Order info symbol = "EURUSD" lot = 0.4 deviation = 20 ###### Clasification Model Predictions pre = 4 pre ##### Order info def send_order(symbol, lot, pre, position_id = None): if pre== 0: pass if pre==1 and position_id == None: request = { "action": mt5.TRADE_ACTION_DEAL, "symbol": symbol, "volume": lot, "type": mt5.ORDER_TYPE_BUY, "deviation": deviation, "magic": 100001, "comment": "EURUSD_5min", "type_time": mt5.ORDER_TIME_GTC, "type_filling": mt5.ORDER_FILLING_IOC} result = mt5.order_send(request) return result if pre==3 and position_id == None: request = { "action": mt5.TRADE_ACTION_DEAL, "symbol": symbol, "volume": lot, "type": mt5.ORDER_TYPE_SELL, "deviation": deviation, "magic": 100001, "comment": "EURUSD_5min", "type_time": mt5.ORDER_TIME_GTC, "type_filling": mt5.ORDER_FILLING_IOC} result = mt5.order_send(request) return result ############ Close Trades if pre==2 and position_id != None: request = { "position": position_id, "action": mt5.TRADE_ACTION_DEAL, "symbol": symbol, "volume": lot, "type": mt5.ORDER_TYPE_SELL, "deviation": deviation, "magic": 100001, "comment": "EURUSD_5min", "type_time": mt5.ORDER_TIME_GTC, "type_filling": mt5.ORDER_FILLING_IOC} result = mt5.order_send(request) return result if pre==4 and position_id != None: request = { "position": position_id, "action": mt5.TRADE_ACTION_DEAL, "symbol": symbol, "volume": lot, "type": mt5.ORDER_TYPE_BUY, "deviation": deviation, "magic": 100001, "comment": "EURUSD_5min", "type_time": mt5.ORDER_TIME_GTC, "type_filling": mt5.ORDER_FILLING_IOC} result = mt5.order_send(request) return result #### Placion Orders place_order = send_order(symbol, lot , pre) print(place_order) ##### Order Identification if len(mt5.positions_get()) != 0 : df_2 = mt5.positions_get() df_2 = pd.DataFrame(df_2) identifier = df_2.iat[0,7].astype(np.int64) elif len(mt5.positions_get()) == 0: identifier = None print(identifier) ##### Closing Orders close_order = send_order(symbol, lot, pre, position_id = identifier) print(close_order)


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px 'Helvetica Neue'; color: #dca10d}

Con risposta

1
Sviluppatore 1
Valutazioni
(68)
Progetti
78
27%
Arbitraggio
13
31% / 62%
In ritardo
15
19%
Gratuito
Pubblicati: 4 codici
Ordini simili
I am looking to buy a ready-made automated trading robot / EA that works on the Tradovate platform and is proven to pass prop firm challenges for Apex Trader Funding, Tradeify, and Lucid Trading.Key Requirements (must be ready-made or very close to plug-and-play):Fully functional on Tradovate (native or via stable bridge/copier/webhook/API integration – MT5 EA + Tradovate bridge is acceptable if it works reliably)
Alex 1000+ USD
Нужен бот для скальпинга именно на Python. Работа напрямую через API биржи (без привязки к TradingView и MetaTrader). Бот будет запускаться локально на ноутбуке / VPS. Критически важна скорость (использование асинхронности, WebSockets
Mambo 30+ USD
I need a bot that can trade weltrade synthetic indices that can be consistently making profits if you have one for deriv its also fine a bot that executes and closes trades automat Will be ideal
I am looking for an experienced MQL4/MQL5 developer to build a custom MT4 indicator from scratch or cracking my ex4 file that i provide to you. I already have an existing indicator (EX4) which produces highly accurate buy/sell signals. I want a similar indicator developed based on its observable behavior and signal structure. my existing indicator is pc id protected so you have to do PC ID security bypass and source
I need a very advanced and intelligent MT5 Expert Advisor coded in MQL5 for XAUUSD, based on ICT + CRT + Smart Money Concepts. The goal is not a simple robot, but a professional decision-making system with strong filters, risk control, and high-quality trade selection. The EA must include: 1. Multi-Timeframe Analysis - D1 / H4 / H1 bias - M15 / M5 entry confirmation - Bullish or bearish market structure - BOS, CHoCH
I have a 90% completed project with the execution part left to complete, I have been struggling to complete this section and I need help from someone expert in MQL5 with knowledge on forex trading and ICT Concepts coding. Contact me for further details
Patricia Ukawilu 6:43 PM I need help creating an EA to optimize my trade. I already have a preliminary pine script which I will want optimized and create an EA from it to optimize my trade on MT4. I also subscribed to a signal app. I’m looking to automate the execution of the signal from the app so as not to miss out on good trades
I am looking for an experienced MQL5 developer with Python/data analysis skills. I have my own MT5 Strategy Tester reports, exported trade history, and market CSV data. I need help analyzing these files and developing a new independent Expert Advisor based on clearly defined, statistically tested, and validated trading rules. Tasks: Analyze my MT5 Strategy Tester reports and exported trade history. Compare historical
We are looking for a developer to finish and stabilize an existing Kalshi trading bot (~60% complete) built in TypeScript. This is not a MetaTrader EA. The system interacts with the Kalshi API and requires strong understanding of execution logic, order handling, and state management. Scope of Work: Review and understand existing TypeScript codebase Complete missing functionality Fix execution issues (order placement
I need a professional MT5 Expert Advisor (EA) built with clean, modular code. This is an advanced strategy combining liquidity concepts, controlled DCA, hedge protection, and strict risk management. Core Requirements: Entry Logic (ALL must align): Liquidity sweep (Previous Day High/Low breakout and return) EMA50 and EMA200 trend alignment Higher timeframe bias (H1 or H4) RSI confirmation Bollinger Band entry Filters

Informazioni sul progetto

Budget
30 - 60 USD
Scadenze
da 1 a 2 giorno(i)