DinexSpace Pending Order Book Library
- librerie
- Versione: 1.0
DinexSpace Pending Order Book Library is a library for MetaTrader 5 (MT5) that takes a snapshot of the pending orders of your account and lets any program read them by index, with the distance to the market in points.
How it works
- Call DxObRefresh. The library reads the pending orders that match the filter and stores them in a table.
- Read each order by index: ticket, symbol, type, volume, price, stop-limit price, stop loss, take profit, magic number, setup time and expiration.
- Every number you read belongs to the same moment, until you refresh again.
What you get
- Snapshot by ticket for buy limit, buy stop, sell limit, sell stop and the two stop-limit types.
- Distance to the market in points: from the Ask for buy orders and from the Bid for sell orders.
- Filters: symbol, magic number and order type.
- Totals: pending volume by symbol and direction, number of orders, number of orders that expire before a time.
- Status codes with plain-English texts.
- Light: read-only. No DLLs, no web requests, no Sleep. Up to 5 000 orders per snapshot.
How to use it
- Copy DinexPendingBook.ex5 to MQL5\Libraries.
- Add the import block with the functions you use (shown in the images and in the example EA).
- Call DxObSetFilter if you want a filter, then DxObRefresh, then read the values.
- Call DxObRefresh again after orders are placed, changed, triggered or deleted.
Example EA (included in the description images)
The example places and deletes small pending orders in the Strategy Tester, takes snapshots with the library and compares every value with the account. At the end it prints the number of snapshots, the number of orders read and the number of failed checks.
Notes
- The library reports the orders that exist now. It does not place, change or delete orders and gives no entries or exits.
- Library state belongs to each program that uses it.
Requirements
- MetaTrader 5, any symbol and timeframe.
