[CodeFactor] Apply fixes to commit 9697fac

This commit is contained in:
codefactor-io
2026-03-14 05:03:08 +00:00
parent 9697facfb4
commit e35ff7fa3f
164 changed files with 458 additions and 530 deletions
+8 -8
View File
@@ -178,21 +178,21 @@ public sealed class Asi : ITValuePublisher
double R;
if (absHC >= absLC && absHC >= absHL)
{
R = Math.FusedMultiplyAdd(-0.5, absLC, absHC) + 0.25 * absC1O1;
R = Math.FusedMultiplyAdd(-0.5, absLC, absHC) + (0.25 * absC1O1);
}
else if (absLC >= absHC && absLC >= absHL)
{
R = Math.FusedMultiplyAdd(-0.5, absHC, absLC) + 0.25 * absC1O1;
R = Math.FusedMultiplyAdd(-0.5, absHC, absLC) + (0.25 * absC1O1);
}
else
{
R = absHL + 0.25 * absC1O1;
R = absHL + (0.25 * absC1O1);
}
if (R > 0.0)
{
// SI = 50 * [(C-C1) + 0.5*(C-O) + 0.25*(C1-O1)] / R * (K/T)
double numerator = Math.FusedMultiplyAdd(0.5, close - open, close - prevClose) + 0.25 * (prevClose - prevOpen);
double numerator = Math.FusedMultiplyAdd(0.5, close - open, close - prevClose) + (0.25 * (prevClose - prevOpen));
si = 50.0 * numerator / R * (K / _limitMove);
}
}
@@ -348,20 +348,20 @@ public sealed class Asi : ITValuePublisher
double R;
if (absHC >= absLC && absHC >= absHL)
{
R = Math.FusedMultiplyAdd(-0.5, absLC, absHC) + 0.25 * absC1O1;
R = Math.FusedMultiplyAdd(-0.5, absLC, absHC) + (0.25 * absC1O1);
}
else if (absLC >= absHC && absLC >= absHL)
{
R = Math.FusedMultiplyAdd(-0.5, absHC, absLC) + 0.25 * absC1O1;
R = Math.FusedMultiplyAdd(-0.5, absHC, absLC) + (0.25 * absC1O1);
}
else
{
R = absHL + 0.25 * absC1O1;
R = absHL + (0.25 * absC1O1);
}
if (R > 0.0)
{
double numerator = Math.FusedMultiplyAdd(0.5, c - o, c - pc) + 0.25 * (pc - po);
double numerator = Math.FusedMultiplyAdd(0.5, c - o, c - pc) + (0.25 * (pc - po));
si = 50.0 * numerator / R * (K / limitMove);
}
}
+2 -2
View File
@@ -48,11 +48,11 @@ public sealed class CfbIndicator : Indicator, IWatchlistIndicator
protected override void OnInit()
{
// Generate lengths array
int count = (MaxLength - MinLength) / Step + 1;
int count = ((MaxLength - MinLength) / Step) + 1;
int[] lengths = new int[count];
for (int i = 0; i < count; i++)
{
lengths[i] = MinLength + i * Step;
lengths[i] = MinLength + (i * Step);
}
_cfb = new Cfb(lengths);
-1
View File
@@ -299,7 +299,6 @@ public sealed class Cfb : ITValuePublisher, IDisposable
return new TSeries(t, v);
}
/// <summary>
/// Initializes the indicator state using the provided value series history.
/// </summary>
+2 -3
View File
@@ -170,7 +170,7 @@ public sealed class Rsx : ITValuePublisher
double rsx;
if (smoothedAbsMomentum > 1e-10)
{
double v4 = (smoothedMomentum / smoothedAbsMomentum + 1.0) * 50.0;
double v4 = ((smoothedMomentum / smoothedAbsMomentum) + 1.0) * 50.0;
rsx = Math.Clamp(v4, 0.0, 100.0);
}
else
@@ -214,7 +214,6 @@ public sealed class Rsx : ITValuePublisher
return new TSeries(t, v);
}
/// <summary>
/// Initializes the indicator state using the provided series history.
/// </summary>
@@ -328,7 +327,7 @@ public sealed class Rsx : ITValuePublisher
double rsx;
if (smoothedAbsMomentum > 1e-10)
{
double v4 = (smoothedMomentum / smoothedAbsMomentum + 1.0) * 50.0;
double v4 = ((smoothedMomentum / smoothedAbsMomentum) + 1.0) * 50.0;
rsx = Math.Clamp(v4, 0.0, 100.0);
}
else
+6 -6
View File
@@ -176,11 +176,11 @@ public sealed class Sam : AbstractBase
double price1 = s.Price0;
double price0 = price;
double smoothPrice = (price0 + 2.0 * price1 + 2.0 * price2 + price3) / 6.0;
double smoothPrice = (price0 + (2.0 * price1) + (2.0 * price2) + price3) / 6.0;
// ── Stage 2: Hilbert Transform ──
// Adaptive bandwidth based on previous smooth period
double bandwidth = 0.075 * s.DcPeriod + 0.54;
double bandwidth = (0.075 * s.DcPeriod) + 0.54;
// Shift smooth price history
double sp6 = s.Sp5;
@@ -192,7 +192,7 @@ public sealed class Sam : AbstractBase
double sp0 = smoothPrice;
// Detrender: Hilbert Transform of smooth price
double detrender = (0.0962 * sp0 + 0.5769 * sp2 - 0.5769 * sp4 - 0.0962 * sp6) * bandwidth;
double detrender = ((0.0962 * sp0) + (0.5769 * sp2) - (0.5769 * sp4) - (0.0962 * sp6)) * bandwidth;
// Shift detrender history
double det6 = s.Det5;
@@ -204,7 +204,7 @@ public sealed class Sam : AbstractBase
double det0 = detrender;
// Q1 via Hilbert Transform of detrender
double q1 = (0.0962 * det0 + 0.5769 * det2 - 0.5769 * det4 - 0.0962 * det6) * bandwidth;
double q1 = ((0.0962 * det0) + (0.5769 * det2) - (0.5769 * det4) - (0.0962 * det6)) * bandwidth;
// I1 is detrender delayed by 3 bars
double i1 = det3;
@@ -229,10 +229,10 @@ public sealed class Sam : AbstractBase
// ── Stage 3: Phase advance ──
// JI = Hilbert Transform of I1
double ji = (0.0962 * i1_0 + 0.5769 * i1_2 - 0.5769 * i1_4 - 0.0962 * i1_6) * bandwidth;
double ji = ((0.0962 * i1_0) + (0.5769 * i1_2) - (0.5769 * i1_4) - (0.0962 * i1_6)) * bandwidth;
// JQ = Hilbert Transform of Q1
double jq = (0.0962 * q1_0 + 0.5769 * q1_2 - 0.5769 * q1_4 - 0.0962 * q1_6) * bandwidth;
double jq = ((0.0962 * q1_0) + (0.5769 * q1_2) - (0.5769 * q1_4) - (0.0962 * q1_6)) * bandwidth;
// Phasor addition: I2 = I1 - JQ, Q2 = Q1 + JI
double i2Raw = i1 - jq;
-1
View File
@@ -119,7 +119,6 @@ public sealed class Vel : ITValuePublisher, IDisposable
return new TSeries(t, v);
}
/// <summary>
/// Initializes the indicator state using the provided series history.
/// </summary>