diff --git a/Source/Basics/ZL_Series.cs b/Source/Basics/ZL_Series.cs index 04fc419d..7e06bf96 100644 --- a/Source/Basics/ZL_Series.cs +++ b/Source/Basics/ZL_Series.cs @@ -30,6 +30,5 @@ public class ZL_Series : Single_TSeries_Indicator var ret = (TValue.t, (base.Count==0 && base._NaN) ? double.NaN : _zl ); base.Add(ret, update); - } } \ No newline at end of file diff --git a/Source/Feeds/RND_Feed.cs b/Source/Feeds/RND_Feed.cs index 9e33aece..3105d79f 100644 --- a/Source/Feeds/RND_Feed.cs +++ b/Source/Feeds/RND_Feed.cs @@ -17,10 +17,10 @@ public class RND_Feed : TBars double c = startvalue; for (int i = 0; i < bars; i++) { - double o = Math.Round(c + (c * (volatility * 0.1 * rnd.NextDouble() - 0.005)), 2); + double o = Math.Round(c + (c * (((volatility * 0.1) * rnd.NextDouble()) - 0.005)), 2); double h = Math.Round(o + (c * volatility * rnd.NextDouble()), 2); double l = Math.Round(o - (c * volatility * rnd.NextDouble()), 2); - c = Math.Round(l + (h - l) * rnd.NextDouble(), 2); + c = Math.Round(l + ((h - l) * rnd.NextDouble()), 2); double v = Math.Round(1000 * rnd.NextDouble(), 2); this.Add(DateTime.Today.AddDays(i - bars), o, h, l, c, v); } diff --git a/Source/Indicators/CCI_Series.cs b/Source/Indicators/CCI_Series.cs index bac14b9e..f1f6c737 100644 --- a/Source/Indicators/CCI_Series.cs +++ b/Source/Indicators/CCI_Series.cs @@ -20,14 +20,13 @@ public class CCI_Series : Single_TBars_Indicator { private readonly System.Collections.Generic.List _tp = new(); - public CCI_Series(TBars source, int period = 10, bool useNaN = false) - : base(source, period: period, useNaN: useNaN) { - + public CCI_Series(TBars source, int period = 10, bool useNaN = false) : base(source, period: period, useNaN: useNaN) + { if (_bars.Count > 0) { base.Add(_bars); } } - public override void Add((DateTime t, double o, double h, double l, double c, double v) TBar, bool update) { - + public override void Add((DateTime t, double o, double h, double l, double c, double v) TBar, bool update) + { double _tpItem = (TBar.h + TBar.l + TBar.c) / 3.0; if (update) { this._tp[this._tp.Count - 1] = _tpItem; } else { this._tp.Add(_tpItem); } if (this._tp.Count > this._p) { this._tp.RemoveAt(0); } diff --git a/Source/Statistics/KURT_Series.cs b/Source/Statistics/KURT_Series.cs index e91a2c05..ed0a45c4 100644 --- a/Source/Statistics/KURT_Series.cs +++ b/Source/Statistics/KURT_Series.cs @@ -54,7 +54,7 @@ public class KURT_Series : Single_TSeries_Indicator } double _Vx = _s2 / (_n - 1); - double _kurt = (_n > 3) ? (((_n * (_n + 1)) / (((_n - 1) * (_n - 2)) * (_n - 3))) * (_s4 / (_Vx * _Vx)) - (3 * (((_n - 1) * (_n - 1)) / ((_n - 2) * (_n - 3))))) : Double.NaN; + double _kurt = (_n > 3) ? ((((_n * (_n + 1)) / (((_n - 1) * (_n - 2)) * (_n - 3))) * (_s4 / (_Vx * _Vx))) - (3 * (((_n - 1) * (_n - 1)) / ((_n - 2) * (_n - 3))))) : Double.NaN; var result = (TValue.t, (this.Count < this._p - 1 && this._NaN) ? Double.NaN : _kurt); base.Add(result, update);