diff --git a/lib/quantalib.csproj b/lib/quantalib.csproj
index 1c50bbb7..2313d9e9 100644
--- a/lib/quantalib.csproj
+++ b/lib/quantalib.csproj
@@ -47,6 +47,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/lib/trends/mgdi/Mgdi.cs b/lib/trends/mgdi/Mgdi.cs
index 585e96d8..ed85720f 100644
--- a/lib/trends/mgdi/Mgdi.cs
+++ b/lib/trends/mgdi/Mgdi.cs
@@ -2,7 +2,6 @@ using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using QuanTAlib;
namespace QuanTAlib;
@@ -87,11 +86,19 @@ public sealed class Mgdi : AbstractBase
if (Math.Abs(prev) > double.Epsilon)
{
double ratio = price / prev;
+ ratio = Math.Clamp(ratio, 0.3, 3.0);
double ratio4 = ratio * ratio;
ratio4 *= ratio4;
double denominator = _k * _period * ratio4;
- _state.LastMgdi = prev + (price - prev) / denominator;
+ if (Math.Abs(denominator) < 1e-9)
+ {
+ _state.LastMgdi = price;
+ }
+ else
+ {
+ _state.LastMgdi = prev + (price - prev) / denominator;
+ }
}
else
{
@@ -167,11 +174,19 @@ public sealed class Mgdi : AbstractBase
if (Math.Abs(lastMgdi) > double.Epsilon)
{
double ratio = price / lastMgdi;
+ ratio = Math.Clamp(ratio, 0.3, 3.0);
double ratio4 = ratio * ratio;
ratio4 *= ratio4;
double denominator = k * period * ratio4;
- lastMgdi += (price - lastMgdi) / denominator;
+ if (Math.Abs(denominator) < 1e-9)
+ {
+ lastMgdi = price;
+ }
+ else
+ {
+ lastMgdi += (price - lastMgdi) / denominator;
+ }
}
else
{
diff --git a/qodana.yaml b/qodana.yaml
index 95574ff8..bbd03928 100644
--- a/qodana.yaml
+++ b/qodana.yaml
@@ -87,6 +87,11 @@ exclude:
- name: MethodCoverageCheck
- name: CodeCoverageCheck
+ # Library-specific exclusions
+ - name: UnusedMember.Global # Suppresses "Method/Class is never used"
+ - name: UnusedMethodReturnValue.Global # Suppresses "Return value is never used"
+ - name: AutoPropertyCanBeMadeGetOnly.Global # Optional: common in libraries
+
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh
diff --git a/quantalib.ndproj b/quantalib.ndproj
deleted file mode 100644
index 3844323d..00000000
--- a/quantalib.ndproj
+++ /dev/null
@@ -1,529 +0,0 @@
-
-
- ./NDependOut
-
-
-
- .
-
-
-
- .NET 10.0
-
-
- True
- True
- True
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 1
- 1
- 0
- 0
- $ManDay$
- 50
- USD
- After
- 18
- 240
- 8
- 5
- 10
- 20
- 50
- 1200000000
- 12000000000
- 72000000000
- 360000000000
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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