mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-18 10:38:05 +00:00
[CodeFactor] Apply fixes to commit 4a01f03
This commit is contained in:
@@ -112,7 +112,7 @@ public sealed class QqeValidationTests
|
||||
// Strongly trending up
|
||||
for (int i = 0; i < 200; i++)
|
||||
{
|
||||
ind.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 50.0 + i * 0.5));
|
||||
ind.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 50.0 + (i * 0.5)));
|
||||
}
|
||||
|
||||
Assert.True(ind.IsHot);
|
||||
@@ -130,7 +130,7 @@ public sealed class QqeValidationTests
|
||||
// Strongly trending down
|
||||
for (int i = 0; i < 200; i++)
|
||||
{
|
||||
ind.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 200.0 - i * 0.5));
|
||||
ind.Update(new TValue(DateTime.UtcNow.AddMinutes(i), 200.0 - (i * 0.5)));
|
||||
}
|
||||
|
||||
Assert.True(ind.IsHot);
|
||||
@@ -251,7 +251,7 @@ public sealed class QqeValidationTests
|
||||
// Build state well past warmup (WarmupPeriod ≈ 37)
|
||||
for (int i = 0; i < 60; i++)
|
||||
{
|
||||
ind.Update(new TValue(t0.AddSeconds(i), 100.0 + i * 0.5));
|
||||
ind.Update(new TValue(t0.AddSeconds(i), 100.0 + (i * 0.5)));
|
||||
}
|
||||
|
||||
// Anchor bar
|
||||
|
||||
@@ -101,11 +101,11 @@ public sealed class Qqe : AbstractBase
|
||||
_sfAlpha = 2.0 / (smoothFactor + 1.0);
|
||||
_sfBeta = 1.0 - _sfAlpha;
|
||||
|
||||
int darPeriod = 2 * smoothFactor - 1;
|
||||
int darPeriod = (2 * smoothFactor) - 1;
|
||||
_darAlpha = 2.0 / (darPeriod + 1.0);
|
||||
_darBeta = 1.0 - _darAlpha;
|
||||
|
||||
WarmupPeriod = rsiPeriod + smoothFactor + darPeriod * 2;
|
||||
WarmupPeriod = rsiPeriod + smoothFactor + (darPeriod * 2);
|
||||
|
||||
_s = new State(
|
||||
Count: 0,
|
||||
@@ -168,7 +168,7 @@ public sealed class Qqe : AbstractBase
|
||||
double avgGain = s.RmaGain * cRma;
|
||||
double avgLoss = s.RmaLoss * cRma;
|
||||
double rs = avgLoss < Epsilon ? 100.0 : avgGain / avgLoss;
|
||||
double rsiVal = 100.0 - 100.0 / (1.0 + rs);
|
||||
double rsiVal = 100.0 - (100.0 / (1.0 + rs));
|
||||
|
||||
// ── Stage 2: EMA smooth of RSI (α = 2/(SF+1)) with §2 warmup → rsiMA ──
|
||||
s.RawRsiMa = Math.FusedMultiplyAdd(s.RawRsiMa, _sfBeta, rsiVal * _sfAlpha);
|
||||
|
||||
Reference in New Issue
Block a user