/// <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 <TradeBar>(name + "_FastStoch", input => ComputeFastStoch(period, input), fastStoch => _maximum.IsReady, () => _maximum.Reset() ); StochK = new FunctionalIndicator <TradeBar>(name + "_StochK", input => ComputeStochK(period, kPeriod, input), stochK => _maximum.IsReady, () => _maximum.Reset() ); StochD = new FunctionalIndicator <TradeBar>(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() { 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() { _smoother.Reset(); TrueRange.Reset(); base.Reset(); }