I've searched through the internet, but did not find a documentation or informal data on proper order book (Depth of Market, DOM) structure and content. There are numerous articles about what the order book is in general and many examples of trading by it. But there's no exact information what is allowed and what is not. I'm asking because MT5 market book may contain seemingly invalid records, but this invalidy is deduced only by a notion or common sense, yet common sense may be affected by many external factors. ;-) I'd like to have an unbiased algorithmic way to filter out all incorrect states of the order book.
I'd be grateful if experienced traders provide some links on appropriate sources and/or write down the rules here.
I don't know more than you but I am also interested by the subject.
I found this document which seems interesting.
I just began writing the rules starting from most obvious (but they can be wrong, please correct me). Feel free to add more.
- If there are bids higher than the lowest offer, or if there are offers lower than the highest bid - the book is called "crossed", and is still valid (despite the fact that the price levels become inconsistent at the middle): here is the question - what is the spread when the book is crossed?
- The lowest offer and the highest bid can be equal: and here is the question again - what is the spread at such moment?
- It's not possible to have several bids at the same price or several offers at the same price - they should be accumulated in a single item with total volume (I saw such duplicates in market books in MT5, the whole system is very large and complicated so there is no guarantee of not receiving such stuff, this is why I'm putting this here - it seems obvious, but it must be taken into consideration)
This last point seems like a bug, is it reported to Metaquotes ?
I would add :
- Market depth can be fixed or unlimited.
I found this document which seems interesting.
Negative or 0 spread. But is it allowed and managed by MT5 ? No idea. Isn't that depending of the envisaged Market/Exchange ?
This last point seems like a bug, is it reported to Metaquotes ?
I would add :
- Market depth can be fixed or unlimited.
Oh, thank you for the reference - it looks very comprehensive.
I'm not sure how negative spread could work in MT, I created a ticket in SD, but did not receive a reply.
One nuance which was omitted in my question is regarding filling policy. For example, if someone places an order with enormous volume in FOK mode and unfavourable price, it will hang for ever but still move the spread to negative zone, right? But it's apparent that other smaller orders will not execute at this unrealistic price level. But this contradicts to the spread definition, imho. Is it so called inverted or crossed market?
The bugs should be reported when they are reproducable, but MetaTrader's market book is a short living dynamic thing, so I can't provide any details.
Oh, thank you for the reference - it looks very comprehensive.
I'm not sure how negative spread could work in MT, I created a ticket in SD, but did not receive a reply.
One nuance which was omitted in my question is regarding filling policy. For example, if someone places an order with enormous volume in FOK mode and unfavourable price, it will hang for ever but still move the spread to negative zone, right? But it's apparent that other smaller orders will not execute at this unrealistic price level. But this contradicts to the spread definition, imho. Is it so called inverted or crossed market?
I have only theoretical view on this. There should be an order matching engine, I suppose it's not in MT5 itself, as I understand the MT5 server is only working through a gateway.
It would be interesting to have more information, but it's probably working differently on different market. The only question about MT5 would be : if the market is "crossed", is MT5 able to manage that ?
The bugs should be reported when they are reproducable, but MetaTrader's market book is a short living dynamic thing, so I can't provide any details.
Which broker/market did you try ?
Which broker/market did you try ?
MQ Demo, FORTS.
- If there are bids higher than the lowest offer, or if there are offers lower than the highest bid - the book is called "crossed", and is still valid (despite the fact that the price levels become inconsistent at the middle): here is the question - what is the spread when the book is crossed?
- The lowest offer and the highest bid can be equal: and here is the question again - what is the spread at such moment?
I think the "crossed" book occurs during Opening and Closing Auctions (for stocks and other instruments). During this time the spread can be zero or negative, but the real price will only be set at the end of the auction.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I've searched through the internet, but did not find a documentation or informal data on proper order book (Depth of Market, DOM) structure and content. There are numerous articles about what the order book is in general and many examples of trading by it. But there's no exact information what is allowed and what is not. I'm asking because MT5 market book may contain seemingly invalid records, but this invalidy is deduced only by a notion or common sense, yet common sense may be affected by many external factors. ;-) I'd like to have an unbiased algorithmic way to filter out all incorrect states of the order book.
I'd be grateful if experienced traders provide some links on appropriate sources and/or write down the rules here.
I just began writing the rules starting from most obvious (but they can be wrong, please correct me). Feel free to add more.