/// <summary> /// Creates a new Stochastics Indicator from the specified periods. /// </summary> /// <param name="name">The name of this indicator.</param> /// <param name="period">The period given to calculate the Fast %K</param> /// <param name="kPeriod">The K period given to calculated the Slow %K</param> /// <param name="dPeriod">The D period given to calculated the Slow %D</param> public Stochastic(string name, int period, int kPeriod, int dPeriod) : base(name) { _maximum = new Maximum(name + "_Max", period); _mininum = new Minimum(name + "_Min", period); _sumFastK = new Sum(name + "_SumFastK", kPeriod); _sumSlowK = new Sum(name + "_SumD", dPeriod); FastStoch = new FunctionalIndicator <IBaseDataBar>(name + "_FastStoch", input => ComputeFastStoch(period, input), fastStoch => _maximum.IsReady, () => _maximum.Reset() ); StochK = new FunctionalIndicator <IBaseDataBar>(name + "_StochK", input => ComputeStochK(period, kPeriod, input), stochK => _maximum.IsReady, () => _maximum.Reset() ); StochD = new FunctionalIndicator <IBaseDataBar>(name + "_StochD", input => ComputeStochD(period, kPeriod, dPeriod), stochD => _maximum.IsReady, () => _maximum.Reset() ); }
/// <summary> /// Resets this indicator to its initial state /// </summary> public override void Reset() { _previous = null; _smoother.Reset(); TrueRange.Reset(); base.Reset(); }
/// <summary> /// Resets this indicator to its initial state /// </summary> public override void Reset() { ADRatio.Reset(); ADVRatio.Reset(); _arms.Reset(); base.Reset(); }
/// <summary> /// Resets this indicator to its initial state /// </summary> public override void Reset() { _lastHigh = 0m; _lastLow = 0m; _maxMA.Reset(); _minMA.Reset(); base.Reset(); }
/// <summary> /// Resets this indicator to its initial state /// </summary> public override void Reset() { FastStoch.Reset(); StochK.Reset(); StochD.Reset(); _sumFastK.Reset(); _sumSlowK.Reset(); base.Reset(); }
/// <summary> /// Resets this indicator to its initial state /// </summary> public override void Reset() { _prevClose = 0; _priceChangeEma.Reset(); _priceChangeEmaEma.Reset(); _absPriceChangeEma.Reset(); _absPriceChangeEmaEma.Reset(); _tsi.Reset(); Signal.Reset(); base.Reset(); }
/// <summary> /// Resets this indicator to its initial state /// </summary> public override void Reset() { _MACD.Reset(); _maximum.Reset(); _minimum.Reset(); _K.Reset(); _D.Reset(); _maximumD.Reset(); _minimumD.Reset(); _PF.Reset(); _PFF.Reset(); base.Reset(); }
/// <summary> /// Resets this indicator to its initial state /// </summary> public override void Reset() { base.Reset(); _previousInput = null; _trueRange.Reset(); _directionalMovementPlus.Reset(); _directionalMovementMinus.Reset(); _smoothedTrueRange.Reset(); _smoothedDirectionalMovementPlus.Reset(); _smoothedDirectionalMovementMinus.Reset(); _averageDirectionalIndex.Reset(); PositiveDirectionalIndex.Reset(); NegativeDirectionalIndex.Reset(); }
/// <summary> /// Initializes a new instance of the <see cref="AverageDirectionalIndex"/> class. /// </summary> /// <param name="name">The name.</param> /// <param name="period">The period.</param> public AverageDirectionalIndex(string name, int period) : base(name) { _period = period; _trueRange = new FunctionalIndicator <IBaseDataBar>(name + "_TrueRange", ComputeTrueRange, isReady => _previousInput != null ); _directionalMovementPlus = new FunctionalIndicator <IBaseDataBar>(name + "_PositiveDirectionalMovement", ComputePositiveDirectionalMovement, isReady => _previousInput != null ); _directionalMovementMinus = new FunctionalIndicator <IBaseDataBar>(name + "_NegativeDirectionalMovement", ComputeNegativeDirectionalMovement, isReady => _previousInput != null ); PositiveDirectionalIndex = new FunctionalIndicator <IndicatorDataPoint>(name + "_PositiveDirectionalIndex", input => { // Computes the Plus Directional Indicator(+DI period). if (_smoothedTrueRange != 0 && _smoothedDirectionalMovementPlus.IsReady) { return(100m * _smoothedDirectionalMovementPlus.Current.Value / _smoothedTrueRange.Current.Value); } return(0m); }, positiveDirectionalIndex => _smoothedDirectionalMovementPlus.IsReady, () => { _directionalMovementPlus.Reset(); _trueRange.Reset(); } ); NegativeDirectionalIndex = new FunctionalIndicator <IndicatorDataPoint>(name + "_NegativeDirectionalIndex", input => { // Computes the Minus Directional Indicator(-DI period). if (_smoothedTrueRange != 0 && _smoothedDirectionalMovementMinus.IsReady) { return(100m * _smoothedDirectionalMovementMinus.Current.Value / _smoothedTrueRange.Current.Value); } return(0m); }, negativeDirectionalIndex => _smoothedDirectionalMovementMinus.IsReady, () => { _directionalMovementMinus.Reset(); _trueRange.Reset(); } ); _smoothedTrueRange = new FunctionalIndicator <IndicatorDataPoint>(name + "_SmoothedTrueRange", input => { // Computes the Smoothed True Range value. var value = Samples > _period + 1 ? _smoothedTrueRange.Current.Value / _period : 0m; return(_smoothedTrueRange.Current.Value + _trueRange.Current.Value - value); }, isReady => Samples > period ); _smoothedDirectionalMovementPlus = new FunctionalIndicator <IndicatorDataPoint>(name + "_SmoothedDirectionalMovementPlus", input => { // Computes the Smoothed Directional Movement Plus value. var value = Samples > _period + 1 ? _smoothedDirectionalMovementPlus.Current.Value / _period : 0m; return(_smoothedDirectionalMovementPlus.Current.Value + _directionalMovementPlus.Current.Value - value); }, isReady => Samples > period ); _smoothedDirectionalMovementMinus = new FunctionalIndicator <IndicatorDataPoint>(name + "_SmoothedDirectionalMovementMinus", input => { // Computes the Smoothed Directional Movement Minus value. var value = Samples > _period + 1 ? _smoothedDirectionalMovementMinus.Current.Value / _period : 0m; return(_smoothedDirectionalMovementMinus.Current.Value + _directionalMovementMinus.Current.Value - value); }, isReady => Samples > period ); _averageDirectionalIndex = new WilderMovingAverage(period); }
/// <summary> /// Resets this indicator to its initial state /// </summary> public override void Reset() { _maxMA.Reset(); _minMA.Reset(); base.Reset(); }
/// <summary> /// Resets this indicator to its initial state /// </summary> public override void Reset() { _smoother.Reset(); TrueRange.Reset(); base.Reset(); }