Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:QuantModel.Indicators.Boll"/> class.
 /// </summary>
 /// <param name="source">Source.</param>
 /// <param name="cycle">Cycle.</param>
 /// <param name="deviation">Deviation.</param>
 public Boll(IIndicator <double> source, int cycle, double deviation)
 {
     Source    = source;
     Cycle     = cycle;
     Deviation = deviation;
     Middle    = Source.SMA(Cycle);
     Std       = source.StdDev(cycle, Middle);
     Upper     = BinaryOperation.Create(Middle, Std, (i, j) => i + j * Deviation);
     Lower     = BinaryOperation.Create(Middle, Std, (i, j) => i - j * Deviation);
 }
Пример #2
0
 /// <summary>
 /// Recommanded Constructor
 /// </summary>
 /// <param name="source">Source</param>
 /// <param name="period">Period</param>
 /// <param name="deviation">Deviation</param>
 public BOLL(IIndicator <double> source, int period, double deviation)
 {
     Source         = source;
     Period         = period;
     Deviation      = deviation;
     Middle         = Source.SMA(Period);
     Std            = Source.StdDev(Period, Middle);
     Upper          = new BinaryOperation <double, double, double>(Middle, Std, (m, s) => m + Deviation * s);
     Lower          = new BinaryOperation <double, double, double>(Middle, Std, (m, s) => m - Deviation * s);
     Upper.Update  += Main;
     Middle.Update += Main;
     Lower.Update  += Main;
 }