I'm trying to print Order details of a strategy in backtesting. But the following code is recognizing only those strategies that have been enabled but not the strategy that I'm backtesting. Could you help me understand what I'm missing?
... else if (State == State.DataLoaded) { ... allAccts = Account.All; foreach (Account acct in allAccts) { if (acct.Name == "Sim101") { strategyAcct = acct; } } foreach (StrategyBase s in strategyAcct.Strategies) { [B] if (s.Name == "Workbench")[/B] { thisStrategy = s; Print(thisStrategy.Name); } } } protected override void OnBarUpdate() { ... if (strategyAcct != null) { if (thisStrategy != null) { Collection<Order> orders = thisStrategy.Orders; Position position = thisStrategy.Position; foreach (Order order in orders) { if (order.OrderType == OrderType.Limit && position != null) { Print(Time[0] + "\t" + order.FromEntrySignal + "\t" + order.Instrument + "\t" + order.LimitPrice); } } } } }
CV
Comment