You have to go to Freelancer to rewrite the code which is different for MT5 or contact the seller if you bought it somewhere any maybe a version exists.
None of the "converters" you find on the internet will work correctly.
Dear Anyone,
Can someone help to convert this mql4 to mql5 for open trade and close trade ?
This is the mql4 for open trade that I want to use in mql5 but please using OrderSendAsync() :
string koment = komentar + DoubleToStr(MarketInfo(Pair1, MODE_ASK),5) + "/L:" + DoubleToStr(Lot1,3);
int ticket_20 = OrderSend(Pair1, OP_BUY, Lot1, MarketInfo(Pair1, MODE_ASK), Slippage, 0, 0, koment, magictext, 0, CLR_NONE);
#include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006 string koment = komentar + DoubleToString(SymbolInfoDouble(Pair1, SYMBOL_ASK),5) + "/L:" + DoubleToString(Lot1,3); TICKET_TYPE ticket_20 = OrderSendAsync(Pair1, OP_BUY, Lot1, SymbolInfoDouble(Pair1, SYMBOL_ASK), Slippage, 0, 0, koment, magictext);
And this is the mql4 for close trade that I want to use in mql5 but please using OrderCloseAsync() :
void CloseAllOrders() {
int ticket_21 = 0;
for (int order_total_4 = OrdersTotal(); order_total_4 >= 0; order_total_4--) {
if (OrderSelect(order_total_4, SELECT_BY_POS) == true) {
ticket_21 = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, CLR_NONE);
Sleep(10); } }
}
#include <MT4Orders.mqh> // https://www.mql5.com/en/code/16006 void CloseAllOrders() { TICKET_TYPE ticket_21 = 0; for (int order_total_4 = OrdersTotal() - 1; order_total_4 >= 0; order_total_4--) if (OrderSelect(order_total_4, SELECT_BY_POS) == true) ticket_21 = OrderCloseAsync(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage); }

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear Anyone,
Can someone help to convert this mql4 to mql5 for open trade and close trade ?
This is the mql4 for open trade that I want to use in mql5 but please using OrderSendAsync() :
string koment = komentar + DoubleToStr(MarketInfo(Pair1, MODE_ASK),5) + "/L:" + DoubleToStr(Lot1,3);
int ticket_20 = OrderSend(Pair1, OP_BUY, Lot1, MarketInfo(Pair1, MODE_ASK), Slippage, 0, 0, koment, magictext, 0, CLR_NONE);
And this is the mql4 for close trade that I want to use in mql5 but please using OrderCloseAsync() :
void CloseAllOrders() {
int ticket_21 = 0;
for (int order_total_4 = OrdersTotal(); order_total_4 >= 0; order_total_4--) {
if (OrderSelect(order_total_4, SELECT_BY_POS) == true) {
ticket_21 = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), Slippage, CLR_NONE);
Sleep(10); } }
}