The market order has a specific cycle in VertexFX Client API, that should be implemented in your API class as follows:
1- You have to call the NewMarketOrder function, which should return CallingResultsEnum result.
2- If SuccessResult has returned then you will receive:
Event NewOrderResult(ByRef Result As VertexFXClientAPI.NewOrderResultEnum, ByRef AtPrice As Double, ByRef PosOrOrder As Long, ByRef OrderID As Long, ByRef BuySell As VertexGeneral.OperationTypeEnum, ByRef Lots As Double, Symbol As VertexFXClientAPI.COSymbol, ByRef ServerTime As String, ByRef TransTag As String)
4- Else If PosOrOrder equal 2, this means that it is done as order and waiting for Backoffice reply (Auto-Broker is Off); in this case, you will receive either of MarketOrderRejected or MarketOrderAccepted when the Backoffice replied to your order. Then the cycle has finished.3- If PosOrOrder equal 1, this means that it is done as a position, in this case, the cycle has finished; Because it was accepted automatically by the Backoffice (Auto-Broker is On).
Note: NewOpenPosition event is fired in all online sessions that are selected the same account, If Multi-Sessions is allowed, to reflect the changes that are happening in open positions so it will be fired in all cases.
VertexFX Client API Index