public override void OnTrade(Trade trade) { if (Bars.Count > length) { if (trade.Price > highestHigh + Bars[Bars.Count - 1].Range) { count++; if (count >= 10) { Signal(+1); return; } } else count = 0; if (trade.Price < lowestLow - Bars[Bars.Count - 1].Range) { Signal(-1); return; } } Signal(0); }
internal void OnTrade(Trade trade) { if (TraceOnTrade) { this.fillPrice = this.trailPrice = this.currPrice = GetPrice(trade.Price); this.method_1(); } }
public override void EmitTrade(Trade trade) { // Emit trade to BuySide strategy. base.EmitTrade(trade); System.Collections.Generic.LinkedListNode<OrderProcessor> processorNode = processors.First; // Send trade to order processors. while (processorNode != null) { OrderProcessor processor = processorNode.Value; processor.OnTrade(trade); processorNode = processorNode.Next; } }
protected override void OnTrade(Instrument instrument, Trade trade) { if (instrument == spread) return; if (!isTradeReady) { isTradeReady = true; foreach (Leg leg in spread.Legs) { if (leg.Instrument.Trade == null) { isTradeReady = false; return; } } } // double tradePrice = 0; int tradeSize = Int32.MaxValue; foreach (Leg leg in spread.Legs) { tradePrice += leg.Instrument.Trade.Price * leg.Weight; tradeSize = Math.Min(tradeSize, leg.Instrument.Trade.Size); } // Create new trade for spread instrument. EmitTrade(new Trade(trade.DateTime, 0, spread.Id, tradePrice, tradeSize)); }
public void OnTrade(Trade trade) { // Check conditions for send leg orders. switch (order.Type) { case OrderType.Limit: switch (order.Side) { case OrderSide.Buy: if (trade.Price <= order.Price) SendLegOrders(); break; case OrderSide.Sell: if (trade.Price >= order.Price) SendLegOrders(); break; } break; case OrderType.Stop: switch (order.Side) { case OrderSide.Buy: if (trade.Price >= order.StopPx) SendLegOrders(); break; case OrderSide.Sell: if (trade.Price <= order.StopPx) SendLegOrders(); break; } break; } }
public Trade(Trade trade) : base(trade) { Direction = trade.Direction; }
public void OnTrade(Trade trade) { var orders = GetOrdersBy(trade.InstrumentId); if (orders == null) return; if (FillOnTrade) { foreach (var order in orders) FillWithTrade(order, trade); ClearOrders(); } }
protected internal override void OnStrategyStart() { var data = new Trade(); this.stopwatch.Start(); (DataProvider as PerformanceProvider).EmitData(data, true); }
internal virtual void vmethod_12(Trade trade) { if (this.IsInstance) { this.OnTrade(trade); List<Stop> list = this.idArray_0[trade.instrumentId]; if (list != null) { for (int i = 0; i < list.Count; i++) { Stop stop_ = list[i]; if (stop_.Connected) { stop_.method_5(trade); } } } } }
internal void OnTrade(Trade trade) { if (Strategy?.Status == StrategyStatus.Running) Strategy.EmitTrade(trade); }
internal void OnTrade(Trade trade) { var iId = trade.InstrumentId; var pId = trade.ProviderId + 1; this.latestTrade[iId] = trade; this.tradeByIIdAndPId[pId] = this.tradeByIIdAndPId[pId] ?? new IdArray<Trade>(10240); this.tradeByIIdAndPId[pId][iId] = trade; }
public override void EmitTrade(Trade trade) { var providerId = GetProviderId(); this.framework.EventManager.OnEvent(new Trade(trade) { ProviderId = providerId }); }
public new virtual void EmitTrade(Trade trade) { this.framework.EventManager.OnEvent(new Trade(trade) { ProviderId = (byte)Id }); }
protected override void OnTrade(Instrument instrument, Trade trade) { if (instrument.Id == currentFuturesContract.Id) { Trade rootTrade = new Trade(trade.DateTime, 0, rootInstrument.Id, trade.Price, trade.Size); // Emit trade to to BuySide strategy. EmitTrade(rootTrade); } }
public void OnTrade(Trade trade) { throw new NotImplementedException(); }
public virtual void EmitTrade(Trade trade) { EventManager.OnEvent(new Trade(trade){providerId = (byte)Id}); }
protected virtual void OnTrade(Trade trade) { // noop }
public override void EmitTrade(Trade trade) { EventManager.OnEvent(new Trade(trade){providerId = IsInstance ? (byte)Parent.Id : (byte)Id}); }
protected override void OnTrade(Instrument instrument, Trade trade) { this.stopwatch.Stop(); }
private bool FillWithTrade(Order order, Trade trade) { while (true) { switch (order.Type) { case OrderType.Market: case OrderType.Pegged: this.Fill(order, trade.Price, trade.Size); return true; case OrderType.Stop: switch (order.Side) { case OrderSide.Buy: if (trade.Price >= order.StopPx) { if (!FillAtStopPrice) { order.Type = OrderType.Market; continue; } goto IL_DA; } break; case OrderSide.Sell: if (trade.Price <= order.StopPx) { if (!FillAtStopPrice) { order.Type = OrderType.Market; continue; } goto IL_EF; } break; } break; case OrderType.Limit: goto IL_104; case OrderType.StopLimit: switch (order.Side) { case OrderSide.Buy: if (trade.Price >= order.StopPx) { order.Type = OrderType.Limit; continue; } break; case OrderSide.Sell: if (trade.Price <= order.StopPx) { order.Type = OrderType.Limit; continue; } break; } break; } break; } return false; IL_DA: this.Fill(order, order.StopPx, trade.Size); return true; IL_EF: this.Fill(order, order.StopPx, trade.Size); return true; IL_104: switch (order.Side) { case OrderSide.Buy: if (trade.Price <= order.Price) { Fill(order, FillAtLimitPrice ? order.Price : trade.Price, trade.Size); return true; } break; case OrderSide.Sell: if (trade.Price >= order.Price) { Fill(order, FillAtLimitPrice ? order.Price : trade.Price, trade.Size); return true; } break; } return false; IL_1A0: this.Fill(order, trade.Price, trade.Size); return true; }