
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello!
What is the best way to send a market order and ensure that the order is done successfully, even if order volume needs to consume several levels of price of the book?
I am using orders ORDER_TYPE_BUY/ORDER_TYPE_SELL, action TRADE_ACTION_DEAL and filling ORDER_FILLING_FOK, because I want to ensure that the whole volume be dealt, and not only partial.
What happens when the liquidity is not high is that, for example, if first ask price is $80,00 and has only 1 volume and after that ask price $80,01 have more 5 volume on the book. If I send a market buy order, as I described, of 2 volume, MT5 executes the order but it is canceled, because there is no 2 volume available on first level of price, and I chose filling FOK (Fill or Kill). And market orders don't accept input price. In the code it accepts but in the documentation it says that if price is informed, it will be ignored for market orders.
But the general concept of market order is to deal the requested volume at all needed price levels, which in this case would be at $80,00 and $80,01.
How do I do for the market order consume all needed price levels of the book to liquidate all order volume, instead of cancelling the order due to lack of volume on first level?
Thanks