public void OnNewShortExit(Instrument instrument, int Size, string sComment) { marketOrder = MarketOrder(instrument, Side.Buy, Size); //marketOrder = MarketOrder( Side.Buy, intSize ); marketOrder.Text = sComment; marketOrder.Send(); // Console.WriteLine( instrument.Symbol + " " + sComment ); }
private void SendOrder(Quote quote, SingleOrder order) { order.ExecutionReport += new ExecutionReportEventHandler(order_ExecutionReport); order.StatusChanged += new EventHandler(order_StatusChanged); OutStandingOrdersExist = true; ordersSubmitted.Add(order.ClOrdID, order); order.Send(); //Console.WriteLine( "{0} {1} sent", order.ClOrdID, order.Text ); }
public virtual SingleOrder Execute(Signal signal) { SingleOrder singleOrder = new SingleOrder(); singleOrder.Instrument = signal.Instrument; singleOrder.Strategy = signal.Strategy.Name; singleOrder.StrategyComponent = ((object)signal.Sender).ToString(); singleOrder.StrategyFill = signal.StrategyFill; singleOrder.StrategyPrice = signal.StrategyPrice; singleOrder.ForceMarketOrder = signal.QvSj2cjRxv; if (signal.Fuwj5CvMiW) { singleOrder.FillOnBarMode = (int)signal.R2djQy947W; } switch (signal.Side) { case SignalSide.Buy: singleOrder.Side = Side.Buy; break; case SignalSide.BuyCover: singleOrder.Side = Side.Buy; break; case SignalSide.Sell: singleOrder.Side = Side.Sell; break; case SignalSide.SellShort: singleOrder.Side = Side.SellShort; break; default: throw new NotSupportedException(); } switch (signal.Type) { case SignalType.Market: singleOrder.OrdType = OrdType.Market; break; case SignalType.Limit: singleOrder.OrdType = OrdType.Limit; singleOrder.Price = signal.LimitPrice; break; case SignalType.Stop: singleOrder.OrdType = OrdType.Stop; singleOrder.StopPx = signal.StopPrice; break; case SignalType.StopLimit: singleOrder.OrdType = OrdType.StopLimit; singleOrder.StopPx = signal.StopPrice; singleOrder.Price = signal.LimitPrice; break; case SignalType.TrailingStop: singleOrder.OrdType = OrdType.TrailingStop; singleOrder.TrailingAmt = signal.StopPrice; break; default: throw new NotSupportedException(); } singleOrder.OrderQty = signal.Qty; singleOrder.TimeInForce = signal.TimeInForce; singleOrder.Text = signal.Text; this.MetaStrategyBase.cWMWqoTObJ((StrategyBase)signal.Strategy, singleOrder); singleOrder.Send(); return(singleOrder); }
public virtual SingleOrder Execute(Signal signal) { SingleOrder singleOrder = new SingleOrder(); singleOrder.Instrument = signal.Instrument; singleOrder.Strategy = signal.Strategy.Name; singleOrder.StrategyComponent = signal.Sender.ToString(); singleOrder.StrategyFill = signal.StrategyFill; singleOrder.StrategyPrice = signal.StrategyPrice; singleOrder.ForceMarketOrder = signal.ForceMarketOrder; if (signal.ForceFillOnBarMode) { singleOrder.FillOnBarMode = (int)signal.FillOnBarMode; } switch (signal.Side) { case SignalSide.Buy: singleOrder.Side = Side.Buy; break; case SignalSide.BuyCover: singleOrder.Side = Side.Buy; break; case SignalSide.Sell: singleOrder.Side = Side.Sell; break; case SignalSide.SellShort: singleOrder.Side = Side.SellShort; break; default: throw new NotSupportedException(); } switch (signal.Type) { case SignalType.Market: singleOrder.OrdType = OrdType.Market; break; case SignalType.Limit: singleOrder.OrdType = OrdType.Limit; singleOrder.Price = signal.LimitPrice; break; case SignalType.Stop: singleOrder.OrdType = OrdType.Stop; singleOrder.StopPx = signal.StopPrice; break; case SignalType.StopLimit: singleOrder.OrdType = OrdType.StopLimit; singleOrder.StopPx = signal.StopPrice; singleOrder.Price = signal.LimitPrice; break; case SignalType.TrailingStop: singleOrder.OrdType = OrdType.TrailingStop; singleOrder.StopPx = signal.StopPrice; break; default: throw new NotSupportedException(); } singleOrder.OrderQty = signal.Qty; singleOrder.TimeInForce = signal.TimeInForce; singleOrder.Text = signal.Text; base.MetaStrategyBase.RegisterOrder(signal.Strategy, singleOrder); singleOrder.Send(); return singleOrder; }