/// <summary> /// To handle the input value. /// </summary> /// <param name="input">The input value.</param> /// <returns>The resulting value.</returns> protected override IIndicatorValue OnProcess(IIndicatorValue input) { var mpValue = MedianPrice.Process(input); var sValue = ShortMa.Process(mpValue).GetValue <decimal>(); var lValue = LongMa.Process(mpValue).GetValue <decimal>(); return(new DecimalIndicatorValue(this, sValue - lValue)); }
/// <summary> /// To handle the input value. /// </summary> /// <param name="input">The input value.</param> /// <returns>The resulting value.</returns> protected override IIndicatorValue OnProcess(IIndicatorValue input) { //если кол-во в буфере больше Shift, то первое значение отдали в прошлый раз, удалим его. if (Buffer.Count > Shift) { Buffer.RemoveAt(0); } var smaResult = _sma.Process(_medianPrice.Process(input)); if (_sma.IsFormed & input.IsFinal) { Buffer.Add(smaResult.GetValue <decimal>()); } return(Buffer.Count > Shift ? new DecimalIndicatorValue(this, Buffer[0]) : new DecimalIndicatorValue(this)); }