[CodeFactor] Apply fixes to commit 03fb54b

This commit is contained in:
codefactor-io
2026-03-16 19:46:41 +00:00
parent 03fb54b7c8
commit 49e67dac30
2 changed files with 12 additions and 12 deletions
+7 -7
View File
@@ -88,7 +88,7 @@ public class RsTests
for (int i = 0; i < 20; i++)
{
double basePrice = 200.0 + i;
double compPrice = 100.0 + i * 0.5;
double compPrice = 100.0 + (i * 0.5);
rs.Update(basePrice, compPrice);
results.Add(rs.Last.Value);
}
@@ -382,8 +382,8 @@ public class RsTests
// Base grows faster than comparison
for (int i = 0; i < 20; i++)
{
double basePrice = 100.0 + i * 2; // +2 per bar
double compPrice = 100.0 + i * 1; // +1 per bar
double basePrice = 100.0 + (i * 2); // +2 per bar
double compPrice = 100.0 + (i * 1); // +1 per bar
rs.Update(basePrice, compPrice);
}
@@ -399,8 +399,8 @@ public class RsTests
// Base grows slower than comparison
for (int i = 0; i < 20; i++)
{
double basePrice = 100.0 + i * 1; // +1 per bar
double compPrice = 100.0 + i * 2; // +2 per bar
double basePrice = 100.0 + (i * 1); // +1 per bar
double compPrice = 100.0 + (i * 2); // +2 per bar
rs.Update(basePrice, compPrice);
}
@@ -416,8 +416,8 @@ public class RsTests
// Both grow at same rate
for (int i = 0; i < 20; i++)
{
double basePrice = 100.0 + i * 2;
double compPrice = 50.0 + i * 1;
double basePrice = 100.0 + (i * 2);
double compPrice = 50.0 + (i * 1);
rs.Update(basePrice, compPrice);
}
+5 -5
View File
@@ -150,12 +150,12 @@ public sealed class SarBasicTests
// Steady uptrend - SAR should trail below
for (int i = 0; i < 20; i++)
{
double price = 100.0 + i * 2;
double price = 100.0 + (i * 2);
_ = sar.Update(new TBar(DateTime.UtcNow.AddMinutes(i),
price + 1, price - 1, price + 0.5, price, 1000));
}
double lastClose = 100.0 + 19 * 2;
double lastClose = 100.0 + (19 * 2);
Assert.True(sar.SarValue < lastClose, "SAR should be below price in uptrend");
Assert.True(sar.IsLong, "Should be in long mode during uptrend");
}
@@ -168,12 +168,12 @@ public sealed class SarBasicTests
// Steady downtrend - SAR should trail above
for (int i = 0; i < 20; i++)
{
double price = 200.0 - i * 2;
double price = 200.0 - (i * 2);
_ = sar.Update(new TBar(DateTime.UtcNow.AddMinutes(i),
price + 1, price - 1, price + 0.5, price, 1000));
}
double lastClose = 200.0 - 19 * 2;
double lastClose = 200.0 - (19 * 2);
Assert.True(sar.SarValue > lastClose, "SAR should be above price in downtrend");
Assert.False(sar.IsLong, "Should be in short mode during downtrend");
}
@@ -423,7 +423,7 @@ public sealed class SarConsistencyTests
// Continue uptrend
for (int i = 1; i <= 5; i++)
{
double price = 105 + i * 2;
double price = 105 + (i * 2);
_ = sar.Update(new TBar(dt.AddMinutes(i),
price + 1, price - 1, price + 0.5, price, 1000), isNew: true);
}