[CodeFactor] Apply fixes to commit 0606491

This commit is contained in:
codefactor-io
2026-03-12 19:37:50 +00:00
parent 060649192f
commit 8f79257155
384 changed files with 1197 additions and 1215 deletions
@@ -303,14 +303,14 @@ public class TtmTrendIndicatorTests
// Feed historical bars
for (int i = 0; i < 5; i++)
{
indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 2, 110 + i * 2, 90 + i * 2, 105 + i * 2);
indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 2), 110 + (i * 2), 90 + (i * 2), 105 + (i * 2));
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
}
// Feed new bars
for (int i = 5; i < 8; i++)
{
indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i * 2, 110 + i * 2, 90 + i * 2, 105 + i * 2);
indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + (i * 2), 110 + (i * 2), 90 + (i * 2), 105 + (i * 2));
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.NewBar));
}
@@ -81,7 +81,7 @@ public class TtmTrendBasicTests
// EMA = alpha * value + (1 - alpha) * prevEMA
// EMA = 0.2857 * 107 + 0.7143 * 100 = 30.57 + 71.43 = 102.0
double alpha = 2.0 / 7.0;
double expected = alpha * 107.0 + (1 - alpha) * 100.0;
double expected = (alpha * 107.0) + ((1 - alpha) * 100.0);
Assert.Equal(expected, result.Value, 10);
}
@@ -360,7 +360,7 @@ public class TtmTrendBarCorrectionTests
// Should use 105 instead of 110
double alpha = 2.0 / 7.0;
double expected = alpha * 105.0 + (1 - alpha) * 100.0;
double expected = (alpha * 105.0) + ((1 - alpha) * 100.0);
Assert.Equal(expected, corrected.Value, 10);
}
}
@@ -64,7 +64,7 @@ public class TtmTrendValidationTests
// Feed enough bars to warm up, then inject consistently rising prices
for (int i = 0; i < 20; i++)
{
double price = basePrice + i * 2.0;
double price = basePrice + (i * 2.0);
var bar = new TBar(
DateTime.UtcNow.AddMinutes(i),
price - 0.5, price + 0.5, price - 0.5, price, 1000);
@@ -84,7 +84,7 @@ public class TtmTrendValidationTests
// Feed enough bars to warm up, then inject consistently falling prices
for (int i = 0; i < 20; i++)
{
double price = basePrice - i * 2.0;
double price = basePrice - (i * 2.0);
var bar = new TBar(
DateTime.UtcNow.AddMinutes(i),
price + 0.5, price + 0.5, price - 0.5, price, 1000);