public virtual Stop AddStop(Position position, double level, StopType type, StopMode mode) { if (!this.Strategy.IsInstrumentActive(position.Instrument)) return null; else return new Stop(this.Strategy, position, level, type, mode); }
public virtual Stop AddStop(Position position, DateTime time) { if (!this.Strategy.IsInstrumentActive(position.Instrument)) return null; else return new Stop(this.Strategy, position, time); }
public Stop(StrategyBase strategy, Position position, DateTime time):base() { this.Udd6EeE9v6 = strategy; this.fPosition = position; this.fInstrument = position.Instrument; this.fQty = position.Qty; this.fSide = position.Side; this.fType = StopType.Time; this.fCreationTime = Clock.Now; this.fCompletionTime = time; this.fStopPrice = this.fInstrument.Price(); if (!(this.fCompletionTime > this.fCreationTime)) return; Clock.AddReminder(new ReminderEventHandler(this.mSa6vRBe3Z), this.fCompletionTime, (object) null); this.Udd6EeE9v6.AddStop((StopBase) this); }
public Stop(StrategyBase strategy, Position position, double level, StopType type, StopMode mode) :base() { this.Udd6EeE9v6 = strategy; this.fPosition = position; this.fInstrument = position.Instrument; this.fQty = position.Qty; this.fSide = position.Side; this.fLevel = level; this.fType = type; this.fMode = mode; this.fCurrPrice = this.fInstrument.Price(); this.fTrailPrice = this.fCurrPrice; this.fStopPrice = this.SlN6PMZ5Ct(); this.fCreationTime = Clock.Now; this.fCompletionTime = DateTime.MinValue; this.Udd6EeE9v6.AddStop((StopBase) this); this.t276DXCuDr(); }
public ATSStop(Position position, double level, StopType type, StopMode mode) : base() { this.fPosition = position; this.fInstrument = position.Instrument; this.fQty = position.Qty; this.fSide = position.Side; this.fLevel = level; this.fType = type; this.fMode = mode; this.fCurrPrice = this.fInstrument.Price(); this.fTrailPrice = this.fCurrPrice; this.fStopPrice = this.lkZijZtYnj(); this.fCreationTime = Clock.Now; this.fCompletionTime = DateTime.MinValue; this.series = new DoubleSeries(); if (this.fType == StopType.Trailing) this.series.Add(this.fCreationTime, this.lkZijZtYnj()); this.Connect(); }
public void OnPositionClosed(Position position) { if (position != this.fPosition) return; this.Disconnect(); this.Lf6iiLBYf9(StopStatus.Canceled); }
public virtual void OnPositionOpened(Position position) { }
public ATSStop(Position position, DateTime time) : base() { this.fPosition = position; this.fInstrument = position.Instrument; this.fQty = position.Qty; this.fSide = position.Side; this.fType = StopType.Time; this.fCreationTime = Clock.Now; this.fCompletionTime = time; this.fStopPrice = this.fInstrument.Price(); this.series = new DoubleSeries(); if (this.fType == StopType.Trailing) this.series.Add(this.fCreationTime, this.lkZijZtYnj()); if (!(this.fCompletionTime > this.fCreationTime)) return; Clock.AddReminder(new ReminderEventHandler(this.tQYi7Nff5A), this.fCompletionTime, (object)null); }
protected virtual void OnPositionChanged(Position position) { }
protected virtual void OnPositionOpened(Position position) { }
public virtual void OnPositionValueChanged(Position position) { }
public void Remove(Position position) { this.positions.Remove(position.Name); }
protected override void OnPositionChanged(Position position) { this.A6MpF2380O.OnPositionChanged(position); this.HeHpDewVKD.OnPositionChanged(position); this.ayRpJCTRPY.OnPositionChanged(position); Instrument instrument = position.Instrument; this.exits[instrument].OnPositionChanged(); this.entries[instrument].OnPositionChanged(); this.moneyManagers[instrument].OnPositionChanged(); this.riskManagers[instrument].OnPositionChanged(); }
internal void xbx6LKbgmx(Position obj0) { if (obj0 != this.fPosition) return; this.Disconnect(); this.Lk960PQCI8(StopStatus.Canceled); }
public double Price(FreeQuant.Instruments.Position position) { return(this.pricer.Price(new Position(position))); }
public ICollection Clone() { Position[] positionArray = new Position[this.positions.Values.Count]; this.positions.Values.CopyTo(positionArray, 0); return positionArray; }
public bool Contains(Position position) { return this.positions.ContainsValue(position); }
public virtual void OnPositionClosed(Position position) { }
protected override void OnPositionClosed(Position position) { Instrument instrument = position.Instrument; foreach (ATSStop atsStop in new ArrayList((ICollection) this.activeStops[instrument])) { if (atsStop.Type == StopType.Time && atsStop.Status == StopStatus.Active || atsStop.Connected) atsStop.OnPositionClosed(position); } this.klBiFcxZsD.OnPositionClosed(position); this.csNiLdTRqH[instrument].OnPositionClosed(); }
protected override void OnPositionClosed(Position position) { foreach (Stop stop in new ArrayList((ICollection) this.activeStops[position.Instrument])) { if (stop.Type == StopType.Time && stop.Status == StopStatus.Active || stop.Connected) stop.xbx6LKbgmx(position); } this.A6MpF2380O.OnPositionClosed(position); this.HeHpDewVKD.OnPositionClosed(position); this.ayRpJCTRPY.OnPositionClosed(position); Instrument instrument = position.Instrument; this.exits[instrument].OnPositionClosed(); this.entries[instrument].OnPositionClosed(); this.moneyManagers[instrument].OnPositionClosed(); this.riskManagers[instrument].OnPositionClosed(); }
public void Add(Position position) { if (this.positions.Contains(position.Name)) throw new ApplicationException("Already Added. {0}" + position.Name); this.positions.Add(position.Name, position); }
protected override void OnPortfolioValueChanged(Position position) { this.MetaStrategy.MetaRiskManager.OnStrategyPortfolioValueChanged(this); if (!this.isActive) return; this.A6MpF2380O.OnPortfolioValueChanged(position); this.HeHpDewVKD.OnPortfolioValueChanged(position); this.ayRpJCTRPY.OnPortfolioValueChanged(position); Instrument instrument = position.Instrument; this.exits[instrument].OnPositionValueChanged(); this.entries[instrument].OnPositionValueChanged(); this.moneyManagers[instrument].OnPositionValueChanged(); this.riskManagers[instrument].OnPositionValueChanged(); }
public void Add(Transaction transaction) { lock (this.dataLock) { bool posOpened = false; bool posChanged = true; bool posClosed = false; double local_4 = 0.0; double local_5 = 0.0; double local_6 = 0.0; Position position = this.positions[transaction.Instrument]; if (position == null) { position = new Position(this, transaction); this.positions.Add(position); if (this.monitored) this.WatchPosition(position); if (transaction.Margin != 0.0) { local_4 = transaction.Margin; local_6 = 0.0; local_5 = transaction.Debt; position.Margin = transaction.Margin; position.Debt = transaction.Debt; } posOpened = true; } else { if (transaction.Margin != 0.0) { if (position.Side == PositionSide.Long && transaction.Side == Side.Buy || position.Side == PositionSide.Short && (transaction.Side == Side.Sell || transaction.Side == Side.SellShort)) { local_4 = transaction.Margin; local_6 = 0.0; local_5 = transaction.Debt; position.Margin += transaction.Margin; position.Debt += transaction.Debt; } if (position.Side == PositionSide.Long && (transaction.Side == Side.Sell || transaction.Side == Side.SellShort) || position.Side == PositionSide.Short && transaction.Side == Side.Buy) { if (position.Qty == transaction.Qty) { double temp_152 = position.Margin; local_4 = 0.0; local_6 = position.Debt; local_5 = 0.0; position.Margin = 0.0; position.Debt = 0.0; } else if (position.Qty > transaction.Qty) { double temp_131 = transaction.Margin; local_4 = 0.0; local_6 = position.Debt * transaction.Qty / position.Qty; local_5 = 0.0; position.Margin -= transaction.Margin; position.Debt -= local_6; } else { double local_7 = transaction.Qty - position.Qty; double local_8 = local_7 * transaction.Price; if (transaction.Instrument.Factor != 0.0) local_8 *= transaction.Instrument.Factor; double temp_110 = position.Margin; double local_4_1 = transaction.Instrument.Margin * local_7; local_6 = position.Debt; local_5 = local_8 - local_4_1; position.Margin = local_4_1; position.Debt = local_5; } } } position.Add(transaction); if (position.Qty == 0.0) { this.positions.Remove(position); if (this.monitored) this.UnWatchPosition(position); posClosed = true; } } this.transactions.Add(transaction); if (!this.Mk5dJuOhmC && this.persistent) PortfolioManager.Add(this, transaction); this.EmitTransactionAdded(transaction); if (!this.Mk5dJuOhmC) this.account.Add(transaction.CashFlow + local_5 - local_6, transaction.Currency, transaction.DateTime, transaction.Text); if (posOpened) this.EmitPositionOpened(position); if (posChanged) this.EmitPositionChanged(position); if (posClosed) this.EmitPositionClosed(position); this.EmitCompositionChanged(); if (this.Mk5dJuOhmC) return; this.EmitValueChanged(position); } }
protected override void OnPositionOpened(Position position) { this.klBiFcxZsD.OnPositionOpened(position); this.csNiLdTRqH[position.Instrument].OnPositionOpened(); }
private void UnWatchPosition(Position position) { position.Instrument.NewBar -= new BarEventHandler(this.OnNewBar); position.Instrument.NewTrade -= new TradeEventHandler(this.OnNewTrade); }
protected override void OnPortfolioValueChanged(Position position) { this.klBiFcxZsD.OnPositionValueChanged(position); this.csNiLdTRqH[position.Instrument].OnPositionValueChanged(); }
private void EmitPositionClosed(Position position) { if (this.PositionClosed != null) this.PositionClosed(this, new PositionEventArgs(position)); }
protected virtual void OnPortfolioValueChanged(Position position) { }
private void EmitValueChanged(Position position) { if (this.ValueChanged != null) this.ValueChanged(this, new PositionEventArgs(position)); }
protected virtual void OnPositionClosed(Position position) { }
public RoundTrip(Position Position, Instrument Instrument, PositionSide TradePosition, double Amount, double EntryPrice, double ExitPrice, DateTime EntryDateTime, DateTime ExitDateTime) :base() { this.position = Position; this.instrument = Instrument; this.tradePosition = TradePosition; this.amount = Amount; this.entryPrice = EntryPrice; this.exitPrice = ExitPrice; this.entryDateTime = EntryDateTime; this.exitDateTime = ExitDateTime; this.entryCost = 0.0; this.exitCost = 0.0; this.entryValue = EntryPrice * Amount; this.exitValue = ExitPrice * Amount; this.roundTripLowPrice = EntryPrice; this.roundTripHighPrice = EntryPrice; this.status = RoundTripStatus.Closed; }