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:
Miha Kralj
2024-09-23 22:08:40 -07:00
parent 846429eccf
commit 58d72c06ca
244 changed files with 621 additions and 14397 deletions
+10 -4
View File
@@ -6,14 +6,20 @@ namespace QuanTAlib
{
private readonly int _period;
private readonly double _fc;
private CircularBuffer _buffer;
private readonly CircularBuffer _buffer;
private double _lastFrama;
private double _prevLastFrama;
public Frama(int period, double fc = 0.5)
{
if (period < 2)
{
throw new ArgumentException("Period must be at least 2", nameof(period));
}
if (fc <= 0 || fc >= 1)
{
throw new ArgumentException("Fc must be between 0 and 1", nameof(fc));
}
_period = period;
_fc = fc;
@@ -78,11 +84,11 @@ namespace QuanTAlib
}
double n1 = (hh - ll) / _period;
double n2 = (hh1 - ll1 + hh2 - ll2) / (_period / 2);
double n2 = (hh1 - ll1 + hh2 - ll2) / half;
double d = (Math.Log(n2 + double.Epsilon) - Math.Log(n1 + double.Epsilon)) / Math.Log(2);
double d = (Math.Log(n1 + double.Epsilon) - Math.Log(n2 + double.Epsilon)) / Math.Log(2);
double alpha = Math.Exp(-4.6 * (d - 1));
double alpha = Math.Exp(-4.6 * (d - 1) * _fc);
alpha = Math.Max(Math.Min(alpha, 1), 0.01); // Ensure alpha is between 0.01 and 1
_lastFrama = alpha * (Input.Value - _lastFrama) + _lastFrama;