The issue is that parent strategy receive all events as expected, but the 2nd do not receive OnBarUpdate() events.
As 2nd strategy really receive OnStateChange() events I guess I missing to add the underlying instrument or something similar.
Can anyone give a light on this please?
namespace NinjaTrader.NinjaScript.Strategies { // 1st Strategy public class AggregateStrategy : Strategy { protected override void OnStateChange() { Print(">> AggregateStrategy.OnStateChange: | " + State + " | " + Category); if (State == State.SetDefaults) { Description = @"Aggregate Strategy"; Name = "AggregateStrategy"; } else if (State == State.Configure) { } } protected override void OnBarUpdate() { Print(">> AggregateStrategy.OnBarUpdate()"); } } // 2nd Strategy that uses the 1st one public class ParentStrategy : Strategy { protected AggregateStrategy st; protected override void OnStateChange() { Print(">> ParentStrategy.OnStateChange: | " + State + " | " + Category); if (State == State.SetDefaults) { Description = @"The ParentStrategy"; Name = "ParentStrategy"; } else if (State == State.Configure) { ClearOutputWindow(); st = new AggregateStrategy(); Print("Create another strategy"); } } protected override void OnBarUpdate() { Print(">> ParentStrategy.OnBarUpdate()"); } } }
Comment