/// <summary> /// Computes the next value of this indicator from the given state /// </summary> /// <param name="input">The input given to the indicator</param> /// <returns>A new value for this indicator</returns> protected override decimal ComputeNextValue(IndicatorDataPoint input) { _shortRoc.Update(input); _longRoc.Update(input); if (_longRoc.IsReady && _shortRoc.IsReady) { var rocSum = _shortRoc + _longRoc; _lwma.Update(input.Time, rocSum); return(_lwma); } return(decimal.Zero); }
public void ResetsProperly() { var rocp = new RateOfChangePercent(50); foreach (var data in TestHelper.GetDataStream(51)) { rocp.Update(data); } Assert.IsTrue(rocp.IsReady); rocp.Reset(); TestHelper.AssertIndicatorIsInDefaultState(rocp); }
/// <summary> /// Computes the next value of this indicator from the given state /// </summary> /// <param name="input">The input given to the indicator</param> /// <returns>A new value for this indicator</returns> protected override decimal ComputeNextValue(IndicatorDataPoint input) { _ema1.Update(input); if (Samples > _period - 1) { _ema2.Update(_ema1.Current); } if (Samples > 2 * (_period - 1)) { _ema3.Update(_ema2.Current); } if (Samples > 3 * (_period - 1)) { _roc.Update(_ema3.Current); } return(_roc); }
/// <summary> /// Computes the next value of this indicator from the given state /// </summary> /// <param name="time"></param> /// <param name="input">The input given to the indicator</param> /// <returns>A new value for this indicator</returns> protected override DoubleArray Forward(long time, DoubleArray input) { _ema1.Update(time, input); if (_ema1.IsReady) { _ema2.Update(time, _ema1.Current); } if (_ema2.IsReady) { _ema3.Update(time, _ema2.Current); } if (_ema3.IsReady) { _roc.Update(time, _ema3.Current); } return(_roc); }
/// <summary> /// Computes the next value of this indicator from the given state /// </summary> /// <param name="input">The input given to the indicator</param> /// <returns>A new value for this indicator</returns> protected override decimal ComputeNextValue(IndicatorDataPoint input) { _ema1.Update(input); if (_ema1.IsReady) { _ema2.Update(_ema1.Current); } if (_ema2.IsReady) { _ema3.Update(_ema2.Current); } if (_ema3.IsReady) { _roc.Update(_ema3.Current); } return(_roc); }
public bool Update(DateTime time, decimal value) { return(_meanOfPriceChange.Update(time, value) & _priceChange.Update(time, value)); }
internal void UpdateDailyRateOfChange(BaseData data) { _dailyReturn.Update(data.EndTime, data.Value); }