Libraries: CLiveTradeInfo - CHistoryTradeInfo
It's tested with several opening/closing orders/positions, you can try the test demo file on your side.
#include <MQL4TradeCompat_define.mqh> // https://www.mql5.com/en/forum/518160#comment_60549462 #define Bid SymbolInfoDouble(_Symbol, SYMBOL_BID) #define Ask SymbolInfoDouble(_Symbol, SYMBOL_ASK) void OnStart() { Print(AccountInfoString(ACCOUNT_SERVER)); // https://docs.mql4.com/trading/ordersend Print(OrderSend(_Symbol, OP_BUY, 0.1, Ask, 0, 0, 0)); }
Result.
Trades '': market buy 0.1 AUDCAD Trades '': deal #10662681920 buy 0.1 AUDCAD at 0.99357 done (based on order #10922861691) Trades '': accepted market buy 0.1 AUDCAD Trades '': order #10922861691 buy 0.1 / 0.1 AUDCAD at 0.99357 done in 38.948 ms
MetaQuotes-Demo
-1962040197 #include <MQL4TradeCompat_define.mqh> // https://www.mql5.com/en/forum/518160#comment_60549462 #define Bid SymbolInfoDouble(_Symbol, SYMBOL_BID) #define Ask SymbolInfoDouble(_Symbol, SYMBOL_ASK) void OnStart() { Print(AccountInfoString(ACCOUNT_SERVER)); // https://docs.mql4.com/trading/ordersend Print(OrderSend(_Symbol, OP_BUY, 0.1, Ask, 0, 0, 0)); }
Seems there is something wrong on your side, I tested :
Alpari-MT5-Demo
388445700 The main purposes was the repository pool of trades (orders & positions) for both history/live. others can be developed by developers/users.
But thanks for the tip. i added it.
you're right,i changed/updated it to ulong type.
But i tested on testing broker:
MetaQuotes-Demo
1821076608
You can't use `ulong`, because `OrderSend` needs to be able to return -1.
But i tested on testing broker: The result is the same.
The log shows how large the numbers are.
Forum on trading, automated trading systems and testing trading strategies
Libraries: CLiveTradeInfo - CHistoryTradeInfo
fxsaber, 2026.10.13 08:05
Trades '': order #10922861691 buy 0.1 / 0.1 AUDCAD at 0.99357 done in 38.948 ms All in all, quite a few checks need to be performed to ensure everything is working correctly.

CLiveTradeInfo - CHistoryTradeInfo:
The library reconstructs a complete MQL4-style order model on top of the native MQL5 Position, Order, Deal, and History APIs. This design allows legacy MQL4 Expert Advisors to operate with minimal code changes while preserving MQL5.
Author: Hans Alexander Nolawon Djurberg