Beispiel #1
0
        /// <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(IReadOnlyWindow <IndicatorDataPoint> window, IndicatorDataPoint input)
        {
            if (Samples < 2)
            {
                return(0m);
            }
            IEnumerable <double> doubleValues = window.Select(i => Convert.ToDouble(i.Value));
            double std = MathNetStatistics.PopulationStandardDeviation(doubleValues);

            return(Convert.ToDecimal(std));
        }