Mikhail Sukhov:
Как регистрируете заявку.
private Order CreateTakeProfitAndStopLimit(decimal price, bool IsBuy, decimal? stopPrice, decimal? profit, Unit spread, int volume)
{
return new Order
{
Type = OrderTypes.Conditional,
Volume = volume,
Price = price,
Security = this.Security,
Portfolio = this.Portfolio,
Direction = IsBuy ? OrderDirections.Buy : OrderDirections.Sell,
StopCondition = new QuikStopCondition
{
Type = QuikStopConditionTypes.TakeProfitStopLimit,
ExpiryDate = null,
StopPrice = profit,
StopLimitPrice = stopPrice,
Offset = new Unit(decimal.Zero),
Spread = spread,
ActiveTime = null,
},
};
}
var TP_SL = CreateTakeProfitAndStopLimit(candle.OpenPrice - stopLoss - slippage, false, candle.OpenPrice - stopLoss, candle.OpenPrice + takeProfit, new Unit(slippage), Volume);
RegisterOrder(TP_SL);