I contacted the brokerage ModalMais, they informed me that I should always use the following to make it work:
trade.SetTypeFilling (ORDER_FILLING_RETURN);
As I do not understand much of programming, it did not help me much, so that's the question now, how to fix the code if I'm not a programmer, if you can help I'll be very grateful.
@fxDreema

