I'd like to instantiate an indicator in a class usable by both a strategy and and other indicators.
One solution I have found is functional but ugly:
class HelperCode { private SMA sma public HelperCode(NinjaScriptBase ns) { if(ns is Indicator) { sma = ((Indicator)ns).SMA(10); } else if(ns is Strategy) { sma = ((Strategy)ns).SMA(10); } } }
Any help would be appreciated.
Comment