Order EA code

Download PDF
        struct MqlTradeRequest
          ENUM_TRADE_REQUEST_ACTIONS action; // Type of action
          ulong magic; // Expert Advisor ID (magic number)
          ulong order; // Order ticket
          string symbol; // Trade instrument
          double volume; // Requested trade size in lots
          double price; // Price
          double stoplimit; // StopLimit level of the order
          double sl; // Stop Loss level of the order
          double tp; // Take Profit level of the order
          ulong deviation; // Maximum allowed deviation from the requested price
          ENUM_ORDER_TYPE type; // Order type
          ENUM_ORDER_TYPE_FILLING type_filling; // Order type by execution
          ENUM_ORDER_TYPE_TIME type_time; // Order type by duration
          datetime expiration; // Order expiration time (for orders of the ORDER_TIME_
          SPECIFIED type)
          string comment; // Comment to the order

Since there are various orders, each order type has its own set of mandatory parameters. We would not address these fields at length. If even one of the mandatory parameters for a certain order type is not specified or specified incorrectly, the request will be failed.