mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-17 10:08:05 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -20,14 +20,13 @@ public class CCI_Series : Single_TBars_Indicator
|
||||
{
|
||||
private readonly System.Collections.Generic.List<double> _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); }
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user