Регистрация стопзаявок
Atom
02.12.2020


Добрый вечер!

Подскажите, пожалуйста, какой код работает для регистрации стоп-заявки? Скачал последнюю версию S# для Quik8

Код
public static Order StopOrder(Decimal _StopOrder_Volume, Sides _StopOrder_Direction, QuikOrderConditionTypes _QuikOrderConditionTypes, String _Comment = "")
{
// Регистрируем заявку
QuikOrderCondition qoc = new QuikOrderCondition
{
Type = QuikOrderConditionTypes.TakeProfitStopLimit,
StopPrice = _StopOrder_Direction == Sides.Buy ? Current_Price - trade_cfg.Order_TakeProfit : Current_Price + trade_cfg.Order_TakeProfit, // Цена срабатывания Тейк-профит
StopLimitPrice = _StopOrder_Direction == Sides.Buy ? Current_Price + trade_cfg.Order_StopLoss : Current_Price - trade_cfg.Order_StopLoss, // Цена срабатывания Стоп-лимит
Offset = trade_cfg.Order_Offset,
Spread = trade_cfg.Order_Shift,
IsMarketStopLimit = true,
IsMarketTakeProfit = true,
ConditionOrderSide = _StopOrder_Direction,
};
Order New_StopOrder = new Order
{
Portfolio = MyPortfolio,
Security = MySecurity,

// Цена дочерней заявки после срабатывания Стоп-лимит
Direction = _StopOrder_Direction,
Volume = _StopOrder_Volume,
ExpiryDate = DateTime.MaxValue,

Comment = string.Format("{0} {1}", Robot_Trade_Name, OrderType.Stop),

Type = OrderTypes.Conditional,
Condition = qoc,
};
RegisterOrder(New_StopOrder);

return New_StopOrder;
}




Добавить файлы через драг-н-дроп, , или вставить из буфера обмена.

loading
clippy