Search code examples
mql4forexmql5mt4

For a particular pair, how to get a total volume of open Long and Short positions on The Exchage?


In MQL4 ( MT4, MT5 ), how do I get the total volume of open Short and Long positions on the Exchange, for a current pair at the current time?


Solution

  • A thing, you ask to get, is called a Level-3 Depth-of-Market, [L3-DoM].

    Fact 1: there is not a common way to aggregate the Global DoM, may expect just a per Exchange ( a local, market-making, island ) Local DoM, so forget about seeing anything near the orders of magnitude of the average Global FX turnover, published to be about USD 5,400,000,000,000.00

    Fact 2: even the local market-making body ( FX Trading Venue, LP provider, FX Broker et al ) do not expect to receive the Local DoM automatically, as not all bodies aggregate & provide the Local DoM on some public service-provisioning basis.

    Fact 3: given some streaming interfaces can provide a Trader a flow of changes on the DoM, one ought expect using a high-frequency processing tools, to handle more than small/large tens ( hundreds/thousands even tens of thousands in peak hours alike NFP events, etc. ) changes per millisecond to happen. Given a professional trading venue is well oiled with sufficient peering with Prime Banks, Institutional LPs ( and perhaps a few DarkPool LPs ), the majors execute in common a Local DoM in the ranges above USD 50,000,000.00 on each of Long and Short sides.

    Fact 4: some older updates of MetaTrader Terminal 4 started an add-on panel, called similarly a DoM, but there were no programmatic ways to communicate with such add-on panel/data. More details on this part of history are here.

    Fact 5: The proposal, presented in his fairest belief by Daniel, does not provide DoM per-se, but show just your ( a Trader's ) own inventory of positions, placed on the table, not the real DoM landscape.


    If interested in more details, do not hesitate to read more posts on DoM and some other animated latency graphs on Top-of-the-Book Price Lifetime to be able to compare FX Brokers timings against LMAX, Currenex or other LP-providers. For detailed LDG/GDF statistics on speed of changes in the L3-DoM near/during NFP announcement, enjoy the data collected in a Table aggregates from FIX-Protocol Stream Processing, presented in this post.