mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-21 03:58:04 +00:00
[CodeFactor] Apply fixes to commit 02c9271
This commit is contained in:
@@ -162,6 +162,6 @@ namespace QuanTAlib
|
|||||||
[Fact] public void Vortex() => TestIndicatorMultipleFields<momentum::QuanTAlib.VortexIndicator>(new[] { "PlusLine", "MinusLine" });
|
[Fact] public void Vortex() => TestIndicatorMultipleFields<momentum::QuanTAlib.VortexIndicator>(new[] { "PlusLine", "MinusLine" });
|
||||||
|
|
||||||
// Oscillators Indicators
|
// Oscillators Indicators
|
||||||
[Fact] public void Cti() => TestIndicator<oscillator::QuanTAlib.CtiIndicator>("Series");
|
[Fact] public void Cti() => TestIndicator<oscillators::QuanTAlib.CtiIndicator>("Series");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,12 +96,12 @@ public sealed class Cti : AbstractBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for numerical stability
|
// Check for numerical stability
|
||||||
double denomX = points * sxx - sx * sx;
|
double denomX = (points * sxx) - (sx * sx);
|
||||||
double denomY = points * syy - sy * sy;
|
double denomY = (points * syy) - (sy * sy);
|
||||||
|
|
||||||
if (denomX > 0 && denomY > 0)
|
if (denomX > 0 && denomY > 0)
|
||||||
{
|
{
|
||||||
return (points * sxy - sx * sy) / Math.Sqrt(denomX * denomY);
|
return ((points * sxy) - (sx * sy)) / Math.Sqrt(denomX * denomY);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user