Code Quality

This commit is contained in:
Miha Kralj
2022-11-11 11:25:21 -08:00
19 changed files with 31 additions and 95 deletions
-3
View File
@@ -62,7 +62,4 @@ public class ALMA_Series : Single_TSeries_Indicator
_norm += _wt;
}
}
}
+1 -1
View File
@@ -50,7 +50,7 @@ public class ATRP_Series : Single_TBars_Indicator
for (int i = 0; i < _buffer.Count; i++) { _ema += _buffer[i]; }
_ema /= this._buffer.Count;
}
else { _ema = d.v * _k + _lastema * _k1m; }
else { _ema = (d.v * _k) + (_lastema * _k1m); }
this._lastlastema = this._lastema;
this._lastema = _ema;
+1 -2
View File
@@ -13,7 +13,6 @@ Sources:
</summary> */
public class ATR_Series : Single_TBars_Indicator
{
private readonly System.Collections.Generic.List<double> _buffer = new();
@@ -53,7 +52,7 @@ public class ATR_Series : Single_TBars_Indicator
for (int i = 0; i < _buffer.Count; i++) { _ema += _buffer[i]; }
_ema /= this._buffer.Count;
}
else { _ema = d.v * _k + _lastema * _k1m; }
else { _ema = (d.v * _k) + (_lastema * _k1m); }
this._lastlastema = this._lastema;
this._lastema = _ema;
+2 -4
View File
@@ -31,7 +31,6 @@ public class DEMA_Series : Single_TSeries_Indicator
public override void Add((DateTime t, double v) TValue, bool update)
{
if (update)
{
this._lastema1 = this._lastlastema1;
@@ -53,12 +52,11 @@ public class DEMA_Series : Single_TSeries_Indicator
for (int i = 0; i < _buffer.Count; i++) { _sma += _buffer[i]; }
_sma /= this._buffer.Count;
_ema1 = _ema2 = _sma;
}
else
{
_ema1 = TValue.v * this._k + this._lastema1 * this._k1m;
_ema2 = _ema1 * this._k + this._lastema2 * this._k1m;
_ema1 = (TValue.v * this._k) + (this._lastema1 * this._k1m);
_ema2 = (_ema1 * this._k) + (this._lastema2 * this._k1m);
}
double _dema = 2 * _ema1 - _ema2;
+4 -5
View File
@@ -33,7 +33,6 @@ public class TEMA_Series : Single_TSeries_Indicator
public override void Add((DateTime t, double v) TValue, bool update)
{
if (update)
{
this._lastema1 = this._lastlastema1;
@@ -59,12 +58,12 @@ public class TEMA_Series : Single_TSeries_Indicator
}
else
{
_ema1 = TValue.v * this._k + this._lastema1 * this._k1m;
_ema2 = _ema1 * this._k + this._lastema2 * this._k1m;
_ema3 = _ema2 * this._k + this._lastema3 * this._k1m;
_ema1 = (TValue.v * this._k) + (this._lastema1 * this._k1m);
_ema2 = (_ema1 * this._k) + (this._lastema2 * this._k1m);
_ema3 = (_ema2 * this._k) + (this._lastema3 * this._k1m);
}
double _tema = 3 * (_ema1 - _ema2) + _ema3;
double _tema = (3 * (_ema1 - _ema2)) + _ema3;
this._lastlastema1 = this._lastema1;
this._lastlastema2 = this._lastema2;
+1 -1
View File
@@ -60,7 +60,7 @@ public class ZLEMA_Series : Single_TSeries_Indicator
}
else
{
_ema = _zl * this._k + this._lastema * this._k1m;
_ema = (_zl * this._k) + (this._lastema * this._k1m);
}
this._lastlastema = this._lastema;