mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-20 19:48:05 +00:00
Squash
dotcover s1 .sln s1 s1 s2 s3 s4 s5 s1 s2 x x2 x3 x4 x5 x6 x1 sonarcube cleanup1 sonarcube cleanup2 sonarcube cleanup 3 fixes q q q q q q q q q1 q2 q q1 codacy 1
This commit is contained in:
+7
-5
@@ -30,10 +30,12 @@ public class Ema : AbstractBase
|
||||
// inherited _index
|
||||
// inherited _value
|
||||
private readonly int _period;
|
||||
private CircularBuffer _sma;
|
||||
private readonly CircularBuffer _sma;
|
||||
private double _lastEma, _p_lastEma;
|
||||
private double _k, _e, _p_e;
|
||||
private bool _isInit, _p_isInit, _useSma;
|
||||
private double _e, _p_e;
|
||||
private readonly double _k;
|
||||
private bool _isInit, _p_isInit;
|
||||
private readonly bool _useSma;
|
||||
|
||||
public Ema(int period, bool useSma = true)
|
||||
{
|
||||
@@ -50,13 +52,14 @@ public class Ema : AbstractBase
|
||||
Init();
|
||||
}
|
||||
|
||||
public Ema(double alpha) : base()
|
||||
public Ema(double alpha)
|
||||
{
|
||||
_k = alpha;
|
||||
_useSma = false;
|
||||
_sma = new(1);
|
||||
_period = 1;
|
||||
WarmupPeriod = (int)Math.Ceiling(Math.Log(0.05) / Math.Log(1 - _k)); //95th percentile
|
||||
_sma = new(_period);
|
||||
Init();
|
||||
}
|
||||
|
||||
@@ -74,7 +77,6 @@ public class Ema : AbstractBase
|
||||
_lastEma = 0;
|
||||
_isInit = false;
|
||||
_p_isInit = false;
|
||||
_sma = new(_period);
|
||||
}
|
||||
|
||||
protected override void ManageState(bool isNew)
|
||||
|
||||
Reference in New Issue
Block a user