2024-01-07 23:19:19 +02:00
|
|
|
using Newtonsoft.Json;
|
2014-10-31 09:05:52 +02:00
|
|
|
|
|
|
|
|
namespace MtApi5
|
|
|
|
|
{
|
|
|
|
|
public class MqlTradeRequest
|
|
|
|
|
{
|
|
|
|
|
public ENUM_TRADE_REQUEST_ACTIONS Action { get; set; } // Trade operation type
|
2017-08-25 15:32:24 +02:00
|
|
|
public ulong Magic { get; set; } // Expert Advisor ID (magic number)
|
2016-10-07 17:05:06 +03:00
|
|
|
public ulong Order { get; set; } // Order ticket
|
2024-02-20 20:26:39 +02:00
|
|
|
public string Symbol { get; set; } = string.Empty; // Trade symbol
|
2014-10-31 09:05:52 +02:00
|
|
|
public double Volume { get; set; } // Requested volume for a deal in lots
|
|
|
|
|
public double Price { get; set; } // Price
|
|
|
|
|
public double Stoplimit { get; set; } // StopLimit level of the order
|
|
|
|
|
public double Sl { get; set; } // Stop Loss level of the order
|
|
|
|
|
public double Tp { get; set; } // Take Profit level of the order
|
2017-09-07 20:08:01 +02:00
|
|
|
public ulong Deviation { get; set; } // Maximal possible deviation from the requested price
|
2014-10-31 09:05:52 +02:00
|
|
|
public ENUM_ORDER_TYPE Type { get; set; } // Order type
|
|
|
|
|
public ENUM_ORDER_TYPE_FILLING Type_filling { get; set; } // Order execution type
|
|
|
|
|
public ENUM_ORDER_TYPE_TIME Type_time { get; set; } // Order expiration type
|
2018-03-01 11:20:12 +02:00
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public DateTime Expiration // Order expiration time (for the orders of ORDER_TIME_SPECIFIED type)
|
|
|
|
|
{
|
|
|
|
|
get { return Mt5TimeConverter.ConvertFromMtTime(MtExpiration); }
|
|
|
|
|
set { MtExpiration = Mt5TimeConverter.ConvertToMtTime(value); }
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-20 20:26:39 +02:00
|
|
|
public string Comment { get; set; } = string.Empty; // Order comment
|
2017-08-25 15:32:24 +02:00
|
|
|
public ulong Position { get; set; } // Position ticket
|
|
|
|
|
public ulong PositionBy { get; set; } // The ticket of an opposite position
|
2018-02-15 20:32:22 +02:00
|
|
|
|
2018-03-01 11:20:12 +02:00
|
|
|
public int MtExpiration { get; private set; }
|
2018-02-17 00:10:10 +02:00
|
|
|
|
2018-02-15 20:32:22 +02:00
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2018-03-01 11:20:12 +02:00
|
|
|
return $"Action={Action}; Magic={Magic}; Order={Order}; Symbol={Symbol}; Volume={Volume}; Price={Price}; Stoplimit={Stoplimit}; Sl={Sl}; Tp={Tp}; Deviation={Deviation}; Type={Type}; Type_filling={Type_filling}; Type_time={Type_time}; Expiration={Expiration}; Comment={Comment}; Position={Position}; PositionBy={PositionBy}";
|
2018-02-15 20:32:22 +02:00
|
|
|
}
|
2014-10-31 09:05:52 +02:00
|
|
|
}
|
|
|
|
|
}
|