private EMA myEMA;
private Series<double> mySeries;
private SessionIterator mySessionIterator;
protected override void OnStateChange()
{
if (State == State.DataLoaded)
{
myEMA = EMA(20);
mySeries = new Series<double>(this);
mySessionIterator = new SessionIterator(Bars);
}
}
In the above example it sets a reference to the EMA and then construct object in DataLoaded as is dependent on the Bars ?
I have a custom indicator i use which i setup as a reference as in the EMA above ie
private CustomInd1 myCustomInd;
then initialise in the DaraLoaded state.
With regards to ninja provided ones like EMA or SMA etc can they not just be referenced explicity in the onbarupdate method ie
double value = EMA(High, 20)[0];
What in the above is gained with the reference ? Is this needed in a strategy method or an indicator or typically when an indicator is calling a custom indicator within it.
just trying to understand context here of this and the examples i come across.
thanks

Just remember that all Attribute decorations are optional. If an attribute makes no sense, just do not put it on.
Comment