Для изменения размера нажмите или перетащите
Стоп-заявки

Для регистрации стоп-заявок используется тот же метод RegisterOrder, но с указанием стоп-условия TransaqOrderCondition и типа заявки Conditional:

C#
private void SendClick(object sender, RoutedEventArgs e)
{
    var stopOrder = new Order
    {
        Portfolio = Portfolio.SelectedPortfolio,
        Type = OrderTypes.Conditional,
        Security = Security,
        Direction = IsBuy.IsChecked == true ? OrderDirections.Buy : OrderDirections.Sell,
        ExpiryDate = ExpiryDate.Value == null ? (DateTime?) null : ExpiryDate.Value.Value,
    };

    var condition = new TransaqOrderCondition();

    switch (StopOrderType.SelectedIndex)
    {
        case 0:
            condition.Type = TransaqOrderConditionTypes.StopLoss;
            condition.StopLossActivationPrice = StopLossActivationPrice.Text.To<decimal>();
            condition.StopLossOrderPrice = StopLossOrderPrice.Text == "0" || StopLossOrderPrice.Text == string.Empty ? null : new Unit(StopLossOrderPrice.Text.To<decimal>(), StopLossOrderPricePercent.IsChecked.Value ? UnitTypes.Percent : UnitTypes.Absolute);
            condition.StopLossVolume = new Unit(StopLossVolume.Text.To<decimal>(), StopLossVolumePercent.IsChecked.Value ? UnitTypes.Percent : UnitTypes.Absolute);
            condition.StopLossGuardTime = StopLossGuardTime.Text == "0" || StopLossGuardTime.Text == string.Empty ? (int?)null : StopLossGuardTime.Text.To<int>();
            condition.StopLossByMarket = StopLossByMarket.IsChecked.Value;
            break;

        case 1:
            condition.Type = TransaqOrderConditionTypes.TakeProfit;
            condition.TakeProfitActivationPrice = TakeProfitActivationPrice.Text.To<decimal>();
            condition.TakeProfitVolume = new Unit(TakeProfitVolume.Text.To<decimal>(), TakeProfitVolumePercent.IsChecked.Value ? UnitTypes.Percent : UnitTypes.Absolute);
            condition.TakeProfitCorrection = TakeProfitCorrection.Text == "0" || TakeProfitCorrection.Text == string.Empty ? null : new Unit(TakeProfitCorrection.Text.To<decimal>(), TakeProfitCorrectionPercent.IsChecked.Value ? UnitTypes.Percent : UnitTypes.Absolute);
            condition.TakeProfitGuardSpread = TakeProfitGuardSpread.Text == "0" || TakeProfitGuardSpread.Text == string.Empty ? null : new Unit(TakeProfitGuardSpread.Text.To<decimal>(), TakeProfitGuardSpreadPercent.IsChecked.Value ? UnitTypes.Percent : UnitTypes.Absolute);
            condition.TakeProfitGuardTime = TakeProfitGuardTime.Text == "0" || TakeProfitGuardTime.Text == string.Empty ? (int?) null : TakeProfitGuardTime.Text.To<int>();
            condition.TakeProfitByMarket = TakeProfitByMarket.IsChecked.Value;
            break;

        case 2:
            condition.Type = TransaqOrderConditionTypes.TakeProfitStopLoss;

            condition.StopLossActivationPrice = StopLossActivationPrice.Text.To<decimal>();
            condition.StopLossOrderPrice = StopLossOrderPrice.Text == "0" || StopLossOrderPrice.Text == string.Empty ? null : new Unit(StopLossOrderPrice.Text.To<decimal>(), StopLossOrderPricePercent.IsChecked.Value ? UnitTypes.Percent : UnitTypes.Absolute);
            condition.StopLossVolume = new Unit(StopLossVolume.Text.To<decimal>(), StopLossVolumePercent.IsChecked.Value ? UnitTypes.Percent : UnitTypes.Absolute);
            condition.StopLossGuardTime = StopLossGuardTime.Text == "0" || StopLossGuardTime.Text == string.Empty ? (int?)null : StopLossGuardTime.Text.To<int>();
            condition.StopLossByMarket = StopLossByMarket.IsChecked.Value;

            condition.TakeProfitActivationPrice = TakeProfitActivationPrice.Text.To<decimal>();
            condition.TakeProfitVolume = new Unit(TakeProfitVolume.Text.To<decimal>(), TakeProfitVolumePercent.IsChecked.Value ? UnitTypes.Percent : UnitTypes.Absolute);
            condition.TakeProfitCorrection = TakeProfitCorrection.Text == "0" || TakeProfitCorrection.Text == string.Empty ? null : new Unit(TakeProfitCorrection.Text.To<decimal>(), TakeProfitCorrectionPercent.IsChecked.Value ? UnitTypes.Percent : UnitTypes.Absolute);
            condition.TakeProfitGuardSpread = TakeProfitGuardSpread.Text == "0" || TakeProfitGuardSpread.Text == string.Empty ? null : new Unit(TakeProfitGuardSpread.Text.To<decimal>(), TakeProfitGuardSpreadPercent.IsChecked.Value ? UnitTypes.Percent : UnitTypes.Absolute);
            condition.TakeProfitGuardTime = TakeProfitGuardTime.Text == "0" || TakeProfitGuardTime.Text == string.Empty ? (int?) null : TakeProfitGuardTime.Text.To<int>();
            condition.TakeProfitByMarket = TakeProfitByMarket.IsChecked.Value;
            break;
    }

    stopOrder.Condition = condition;

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

Для работы с условиями стоп-заявок коннектор TransaqTrader предоставляет специальный класс TransaqOrderCondition. Данным классом поддерживаются следующие типы стоп-заявок: