Error 4756, Invalid Stops

 
I can't get my EA to place any orders, either Buy or Sell . Below is the code I used, and when I run the EA it says I have invalid stops. Is there something I'm doing wrong, or is my code wrong?
      MqlTradeRequest request = {};
      MqlTradeResult result = {};
      
      request.action   = TRADE_ACTION_DEAL; 
      request.symbol   = _Symbol;           
      request.volume   = LotSize;           
      request.price    = SymbolInfoDouble(_Symbol, SYMBOL_BID); 
      request.type     = ORDER_TYPE_SELL; 
      request.deviation= 10; 
      
      
      if (OrderSend(request, result))
        {
          
          if (result.retcode == TRADE_RETCODE_DONE)
            {
              Print("Successfuly");
            }
          else
            {
              PrintFormat("Order ERROR! %d", result.retcode);
            }
        }
      else
        {
          PrintFormat("Order ERROR! %d", GetLastError());     
        }


 
you need to set the request.sl, request.tp, request.filling, and request.type_filling
But - there's a better streamlined way of programming buy or sell using Trade.mqh instead of the request structure
 
Conor Mcnamara #:
you need to set the request.sl, request.tp, request.filling, and request.type_filling
But - there's a better streamlined way of programming buy or sell using Trade.mqh instead of the request structure
Do you have an example of using Trade.mqh ,  I’m new to writing in MQL5.
 
Mr OIRU #:
Do you have an example of using Trade.mqh ,  I’m new to writing in MQL5.
https://www.mql5.com/en/articles/15299
 
Thank you very much, my code is running now.
 
Can Trade.mqh be used to set Sell Limit and Buy Limit orders, or do I need to use something else for that?
 
Mr OIRU #:
Can Trade.mqh be used to set Sell Limit and Buy Limit orders, or do I need to use something else for that?

It can.

 trade.BuyLimit(vol, price, NULL, 0,0, ORDER_TIME_SPECIFIED, expirationTime);
 trade.SellLimit(vol, price, NULL, 0,0, ORDER_TIME_SPECIFIED, expirationTime);

u don't need to set any expiration time by the way

after typing "trade." press Ctrl + space, you will see the API options

 
Conor Mcnamara #:

It can.

u don't need to set any expiration time by the way

after typing "trade." press Ctrl + space, you will see the API options

Oh, thank you so much. I couldn't find any information about using Trade. in the MQL5 documentation (F1). Can I message you personally for guidance on how to use Trade. ?