I am implementing indicator, where I am using parent timeframe as a filter.
In OnStateChange() method I add aditional data series, like in help described.
else if (State == State.Configure)
{
AddDataSeries(Data.BarsPeriodType.Minute, ParentTFPeriod);
}
else if (State == State.DataLoaded)
{
parentSMA = SMA(BarsArray[1], ParentMAPeriod);
}
private bool parent_trend_filter(AkSignalType signal_type)
{
bool result = true;
switch (signal_type) {
case AkSignalType.Buy:
if (High[0] < parentSMA[0])
result = false;
break;
case AkSignalType.Sell:
if (Low[0] > parentSMA[0])
result = false;
break;
}
return result;
}

Comment