Click or drag to resize

Stop orders

The same RegisterOrder method used to register stop orders, but with ETradeOrderCondition and the Conditional type of order indicating:

C#
private void SendClick(object sender, RoutedEventArgs e)
{
    varstopOrder = new Order
    {
        Portfolio = Portfolio.SelectedPortfolio,
        Type = OrderTypes.Conditional,
        Volume = Volume.Text.To<decimal>(),
        Price = Price.Text.To<decimal>(),
        Security = Security,
        Direction = IsBuy.IsChecked == true ?OrderDirections.Buy : OrderDirections.Sell,
        ExpiryDate = IsOneDay.IsChecked == true ?DateTime.Today : DateTime.MaxValue,
        Condition = new ETradeOrderCondition
        {
            StopType = StopMarket ? ETradeStopTypes.StopMarket : ETradeStopTypes.StopLimit,
            StopPrice = StopPrice.Text.To<decimal>()
        }
    };

    MainWindow.Instance.Trader.RegisterOrder(stopOrder);
    DialogResult = true;
}

Для The special ETradeOrderCondition сlass is given to work with the stop orders conditions. This class supports the following types of stop orders: