I really want to be able to select an MA in my indicator/strategy.... and then use that data in various places.
I have looked at the SampleUniversal MA code... but it seems this is a) terribly inefficient (copies a value on each OnBarUpdate) , and b) does not give me an object I can work with... it just plots the selected MA. Not what I need.
I tried something like this: (sort of psuedo code...not actual code... just the idea.
private Series<double> myseries;
private SMA mySMA;
private EMA myEMA;
...
mySMA = SMA(period);
myEMA = EMA(period);
if (I_selected_SMA) myseries = mySMA;
else if (I_selected_EMA) myseries = myEMA;
but the compiler does not allow assignment of the SMA/EMA object to my target series.
Is this possible? Seems fairly simple, and it would make my life so much easier, rather than subsequent code needing to always test what SMA I chose and then call other methods (eg IsRising) using different arguments...
Thanks,
T.
Comment