vdemydiuk / mtapi

MetaTrader API (terminal bridge)
http://mtapi4.net/
MIT License
521 stars 281 forks source link

[MT4] GetOrders returns orders AND deposit operations. #147

Closed mpvyard closed 5 years ago

mpvyard commented 5 years ago

I got an exception in my code during the order history request. This method: mtapi.GetOrders(OrderSelectSource.MODE_HISTORY) returns not only the order but also the operation with a balance, and MtApi.MtOrder.Operation can contain values greater than 5. For example, the Deposit returns code 6 and the calling code throws an ArgumentOutOfRangeException

Debug screen - http://funkyimg.com/i/2S61q.jpg

vdemydiuk commented 5 years ago

What do you mean of "operation with a balance" ? The function GetOrders with parameter OrderSelectSource.MODE_HISTORY returns order from the history (closed and canceled order). According the documentation order type can have 6 values OP_BUY | 0 | Buy operation OP_SELL | 1 | Sell operation OP_BUYLIMIT | 2 | Buy limit pending order OP_SELLLIMIT | 3 | Sell limit pending order OP_BUYSTOP | 4 | Buy stop pending order OP_SELLSTOP | 5 | Sell stop pending order

https://docs.mql4.com/constants/tradingconstants/orderproperties And value 6 is really is incorrect.

Please provide the steps to reproduce the issue. I need to understand how it can be value 6.

vdemydiuk commented 5 years ago

I have found information on mql forum about non-documented types: 6 is balance 7 is credit 8 is rebate https://www.mql5.com/en/forum/122847.

I will added soon into MtApi.

mpvyard commented 5 years ago

Yeah, that's what I meant :)