Example #1
0
 /// <inheritdoc />
 public override void Reset()
 {
     Min.Reset();
     Max.Reset();
     SoftenedMin.Reset();
     SoftenedMax.Reset();
     SoftenedInput.Reset();
     Regressed.Reset();
     base.Reset();
 }
Example #2
0
        /// <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)
        {
            //todo pass tradebar and update min and max with high or low to allow turtle head for more accuracy.
            Max.Update(time, input);
            Min.Update(time, input);
            SoftenedInput.Update(time, input);
            var lower = SoftenedMax.Current.Value - SoftenedMin.Current.Value;
            // ReSharper disable once CompareOfFloatsByEqualityOperator
            var @out = lower == 0 ? 0 : ((SoftenedInput - SoftenedMin) / lower) * 100d;

            return(@out);
        }