I want to add logic that if _smooth = 1, then there will NO smoothing regardless of the moving average type the user selects and _avg = Input. Input comes from the Indicator's Input Series - Price Type parameter.
This is the code that I have in State == State.DataLoaded
else if (State == State.DataLoaded)
{
//Initialize class level variable including custom Series<>
_trend = new Series<bool>(this);
_avg = new Series<double>(this);
if(_smooth == 1)
{
_avg = Input;
}
else
{
switch (_maType)
{
case MovingAverageTypeLOV.SMA:
_avg = SMA(Input, _smooth).Value;
break;
// case MovingAverageType.SMMA: // Not available at time of Beta 5
// _avg = SMMA(Input, _smooth).Value;
// break;
case MovingAverageTypeLOV.TMA:
_avg = TMA(Input, _smooth).Value;
break;
case MovingAverageTypeLOV.WMA:
_avg = WMA(Input, _smooth).Value;
break;
case MovingAverageTypeLOV.VWMA:
_avg = VWMA(Input, _smooth).Value;
break;
case MovingAverageTypeLOV.TEMA:
_avg = TEMA(Input, _smooth).Value;
break;
case MovingAverageTypeLOV.HMA:
_avg = HMA(Input, _smooth).Value;
break;
case MovingAverageTypeLOV.VMA:
_avg = VMA(Input, _smooth, _smooth).Value;
break;
default:
_avg = EMA(Input, _smooth).Value;
break;
}
}
I know that this error is do to this line:
_avg = Input;
Thanks.
JG

Comment