mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-19 11:08:05 +00:00
[CodeFactor] Apply fixes to commit 0606491
This commit is contained in:
@@ -56,7 +56,7 @@ public class VrIndicatorTests
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
// Create price movement that generates volatility
|
||||
double basePrice = 100 + Math.Sin(i * 0.3) * (5 + i * 0.1);
|
||||
double basePrice = 100 + (Math.Sin(i * 0.3) * (5 + (i * 0.1)));
|
||||
indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 2, basePrice - 2, basePrice, 1000);
|
||||
|
||||
// Process update for each bar to simulate history loading
|
||||
@@ -106,7 +106,7 @@ public class VrIndicatorTests
|
||||
for (int i = 0; i < 60; i++)
|
||||
{
|
||||
// Create price movement with varying amplitude
|
||||
double basePrice = 100 + Math.Sin(i * 0.2) * 5;
|
||||
double basePrice = 100 + (Math.Sin(i * 0.2) * 5);
|
||||
indicator.HistoricalData.AddBar(now.AddMinutes(i), basePrice, basePrice + 2, basePrice - 2, basePrice, 1000);
|
||||
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
|
||||
}
|
||||
@@ -205,7 +205,7 @@ public class VrIndicatorTests
|
||||
// Price with varying HLC
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
double close = 100 + Math.Sin(i * 0.3) * 3;
|
||||
double close = 100 + (Math.Sin(i * 0.3) * 3);
|
||||
double high = close + 2 + Math.Abs(Math.Sin(i * 0.5));
|
||||
double low = close - 2 - Math.Abs(Math.Cos(i * 0.5));
|
||||
indicator.HistoricalData.AddBar(now.AddMinutes(i), close, high, low, close, 1000);
|
||||
@@ -261,7 +261,7 @@ public class VrIndicatorTests
|
||||
|
||||
for (int i = 0; i < 60; i++)
|
||||
{
|
||||
double price = 100 + Math.Sin(i * 0.3) * 5;
|
||||
double price = 100 + (Math.Sin(i * 0.3) * 5);
|
||||
indicator1.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price, 1000);
|
||||
indicator2.HistoricalData.AddBar(now.AddMinutes(i), price, price + 2, price - 2, price, 1000);
|
||||
indicator1.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
|
||||
@@ -365,8 +365,8 @@ public class VrIndicatorTests
|
||||
// Normal market with consistent volatility
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
double price = 100 + Math.Sin(i * 0.1) * 2;
|
||||
double range = 2 + Math.Sin(i * 0.2) * 0.5; // Consistent range
|
||||
double price = 100 + (Math.Sin(i * 0.1) * 2);
|
||||
double range = 2 + (Math.Sin(i * 0.2) * 0.5); // Consistent range
|
||||
indicator.HistoricalData.AddBar(now.AddMinutes(i), price, price + range, price - range, price, 1000);
|
||||
indicator.ProcessUpdate(new UpdateArgs(UpdateReason.HistoricalBar));
|
||||
|
||||
|
||||
@@ -614,8 +614,8 @@ public class VrTests
|
||||
// Build up history with varying volatility
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
double range = 2.0 + (i % 5) * 0.5; // Varying range
|
||||
vr.Update(new TBar(DateTime.UtcNow, 100, 100 + range, 100 - range, 100 + range / 2, 1000));
|
||||
double range = 2.0 + ((i % 5) * 0.5); // Varying range
|
||||
vr.Update(new TBar(DateTime.UtcNow, 100, 100 + range, 100 - range, 100 + (range / 2), 1000));
|
||||
}
|
||||
|
||||
// VR should oscillate around 1.0 over time
|
||||
|
||||
@@ -374,7 +374,7 @@ public class VrValidationTests
|
||||
// Low volatility consolidation
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
vr.Update(new TBar(DateTime.UtcNow, 100, 101, 99, 100 + (i % 2) * 0.5, 1000));
|
||||
vr.Update(new TBar(DateTime.UtcNow, 100, 101, 99, 100 + ((i % 2) * 0.5), 1000));
|
||||
}
|
||||
|
||||
double consolidationVr = vr.Last.Value;
|
||||
@@ -407,7 +407,7 @@ public class VrValidationTests
|
||||
// Gradually increase volatility
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
double range = 1 + i * 0.5;
|
||||
double range = 1 + (i * 0.5);
|
||||
var result = vr.Update(new TBar(DateTime.UtcNow, 100, 100 + range, 100 - range, 100, 1000));
|
||||
vrValues.Add(result.Value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user