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% / 54%
In ritardo
15
19%
In elaborazione
Ordini simili
Fintech robots 30+ USD
Specification I need a grid ea that puts buy stops and sell stops on the chart (only stops no limits). See image Example: if the price moves up filling the buy stops. The ea should place new sell stops below the price for the set parameters. And vice versa. Also if price moves up it should place new buy stops above the last buy stop. So if the parameter is set to 50 buy stops. There should always be 50 buy stops in
Hello, In need an expert advisor that can copy my CFD (GBPUSD) into Futures 6B, along with AUDUSD. & that whenever I close the position, it closes it aswell. Also if there is limited broker API access, I don't mind getting a broker recommendation
I have a full strategy based on indicator and candle based on . i would like to make it into a robot which will trade for me on a specific time and specific rules. i need a person who can do this project for me. If you have done this type of job . you are most welcome for this. Apply only if you know binary trading option and binomo trading platform well and how it works
Hey greetings am in need of a developer that can convert my simple tradingview indicator to MT4 I have the source code of the indicator and is also a public indicator on Tradingview site Kindly bid and let started
Project Description : I am looking for an experienced developer to create a multi-platform trading bot that can execute trades across Binance, Exness, MetaTrader 4/5 (MT4/MT5), and stock exchanges. The bot should implement a trading strategy that combines the Parabolic SAR and EMA 200 indicators, with automated entry and exit conditions for both long and short positions. Key features include: Integration with
I hope you're doing well. I am interested in learning more about your EA (Expert Advisor) trading bot. Specifically, I would like to review some performance data, particularly regarding the Profit and Loss (P&L) over recent weeks. Could you kindly provide a short video with today's date, showcasing the weekly stats from the last two months? I am looking for data covering the period from August 1st, 2024, to October
I need an expert to help me convert chopzone traingview pinescript to mt4, I need an expert to get it done for me on between 1 to 2 days i hope this will be done by then, i will attach the file and my budget is $30 as of minimum here
Fellow devs, I need help converting a futures trading bot from python into MQL5. Code base for the bot already exists, backtests in python look good, however I need to be able to backtest it on tick data with MT5. Would appreciate someone who has experience with futures bots specifically, and even better if you have experience with AMP brokers, and can provide guidance and improvement criteria. A point you note, I
I have just installed a Script which is running on MT4 and MT5 on Mac . The script was made for me by an MQL5 community programmer. The script creates a .csv of the Account History to folder location: users/drive_c/metatrader64/crossover/ApplicationData/MetaQuotes/Terminal/Common/Files/Accounts History I have the following problem: The Scripts require that I manually activate them every time I open MT4 and MT5
Need to copy the trades and orders generated by expert advisors from my MT4 platform to eToro broker. Etoro offers a trading API (). This could be used to make the connection to their propietary web platform. If the programmer considers there is more stable and faster way to do it then I'm open to suggestions

Informazioni sul progetto

Budget
30 - 60 USD
Per lo sviluppatore
27 - 54 USD
Scadenze
da 1 a 2 giorno(i)