Молодцы! Приятно видеть адекватную реакцию.

to usseerr:
Code:
using System;
using System.Collections.Generic;
using TSLab.Script.Handlers;

namespace MyIndicators {
  //[HandlerCategory("Indicators")]
  public class StDeviation : BasePeriodIndicatorHandler, IDouble2DoubleHandler {
    [HandlerParameter(true, "false", NotOptimized = true)]
    public bool Corrected { get; set; }

    public IList<double> Execute(IList<double> source) {
      int count = source.Count;
      var values = new double[count];
      int offs = Corrected ? 1 : 0;
      int period = Period - 1;

      for (int i = offs; i < count; i++) {
        int j = i - period;
        if (j < 0)
          j = 0;
        int n = i - j + 1;

        double sx = 0, sxx = 0;
        for (; j <= i; j++) {
          var x = source[j];
          sx += x;
          sxx += x*x;
        }

        values[i] = Math.Sqrt((sxx - (sx * sx / n)) / (n - offs));
      }
      return values;
    }
  }
}


Attachments
StDeviation.rar (220 downloads)