How to work correctly in MT5 with OrderSend - page 7

 
fxsaber:

I guess an example like this is illustrative.

If you don't do Sleep, you often get a situation where the history has not had time to update after OrderClose and OrderCommission returns a value as if OrderClose has not been done.

Note that this is a script and there can't be any Event-overs. The only way out is a dumb Sleep.

If you rewrite this script with SB, nothing will change.

Do not confuse MT4 with MT5
 
prostotrader:
Don't confuse MT4 with MT5

This and MT5

#include <MT4Orders.mqh> // https://www.mql5.com/ru/code/16006
 
fxsaber:

That and MT5

OP_BUY

There is no such thing in MT5.

They work completely differently.

 
prostotrader:
OP_BUY

There is no such thing in MT5.

They work completely differently.

Instead of running the above code in MT5, you are wasting your time with idle chatter.
 

Forum on trading, automated trading systems and strategy testing

Libraries: MT4Orders

fxsaber, 2016.11.14 13:33

// 13.11.2016:
//   Add: Полная синхронизация OrderSend, OrderModify, OrderClose, OrderDelete с торговым окружением (реал-тайм и история) - как в MT4.
//        Максимальное время синхронизации можно задать через MT4ORDERS::OrderSend_MaxPause в мкс. Среднее время синхронизации в MT5 ~1 мс.
 
fxsaber:
Based on the above, should Sleep(1) be put after each trade?
 
Alexey Kozitsyn:
Based on the above, should Sleep(1) be set after each trade?
No, the synchronisation time is floating. Look at
static bool MT4ORDERS::OrderSend( const MqlTradeRequest &Request, MqlTradeResult &Result );
 
fxsaber:
No, the synchronization time is floating. See
static bool MT4ORDERS::OrderSend( const MqlTradeRequest &Request, MqlTradeResult &Result );

Practice shows that Sleep(1) is enough in the vast majority of cases.

In general, it is quite strange to receive a response from OrderSend about a changed trading environment, when this changed environment itself cannot be read yet.

 
Vasiliy Sokolov:

Practice shows that Sleep(1) is sufficient in the vast majority of cases.

Sometimes Sleep(0) is enough. But there must be a working solution for all cases and for minimal waiting time.
 
fxsaber:
Sometimes Sleep(0) is enough too. But there must be a working solution for all cases and for minimal waiting time.

Why should the developers have to fix the bug from "Mr. Balloon"?

and besides, there's OrderSendAsync().