/// <summary> /// Price with the specified position /// </summary> public virtual double Price(Position position) { if (position.Instrument.Quote.DateTime != DateTime.MinValue) { switch (position.Side) { case PositionSide.Long: if (position.Instrument.Quote.Bid != 0.0) return position.Instrument.Quote.Bid; else break; case PositionSide.Short: if (position.Instrument.Quote.Ask != 0.0) return position.Instrument.Quote.Ask; else break; } } if (position.Instrument.Trade.DateTime != DateTime.MinValue) return position.Instrument.Trade.Price; if (position.Instrument.Bar.DateTime != DateTime.MinValue) return position.Instrument.Bar.Close; else return 0.0; }
public override double Price(Position position) { return this.Pricer.Price(position.position); }
internal Stop(Position position, DateTime dateTime) { this.position = position; this.stop = new ATSStop(position.position, dateTime); this.stop.TrailOnHighLow = true; this.stop.TraceOnBarOpen = true; this.stop.TraceOnBar = true; this.stop.TraceOnQuote = true; this.stop.TraceOnTrade = true; }
internal Stop(Position position, double level, StopType type, StopMode mode) { this.position = position; SmartQuant.Trading.StopType type2 = EnumConverter.Convert(type); SmartQuant.Trading.StopMode mode2 = EnumConverter.Convert(mode); this.stop = new ATSStop(position.position, level, type2, mode2); this.stop.TrailOnHighLow = true; this.stop.TraceOnBarOpen = true; this.stop.TraceOnBar = true; this.stop.TraceOnQuote = true; this.stop.TraceOnTrade = true; }
internal Stop(Position position, double level, StopType type, StopMode mode) { this.position = position; FreeQuant.Trading.StopType stopType = EnumConverter.Convert(type); FreeQuant.Trading.StopMode stopMode = EnumConverter.Convert(mode); this.stop = new ATSStop(position.position, level, stopType, stopMode); ((StopBase)this.stop).TrailOnHighLow = true; ((StopBase)this.stop).TraceOnBarOpen = true; ((StopBase)this.stop).TraceOnBar = true; ((StopBase)this.stop).TraceOnQuote = true; ((StopBase)this.stop).TraceOnTrade = true; }