As pseudocode, in a Strategy where the Indicator is referenced (NT8 - Performance practices | Referencing indicator methods) :
private SMA mySma; protected override void OnStateChange() { if (State == State.Historical) { mySma = SMA(20); } } protected override void OnBarUpdate() { if(conditionToRemove) { mySma.Dispose(); } }
Comment