normalization of methods

This commit is contained in:
Miha Kralj
2026-02-10 21:33:16 -08:00
parent 915d7a007b
commit 6d6259a47d
527 changed files with 10525 additions and 2123 deletions
+3 -3
View File
@@ -423,7 +423,7 @@ public class RviTests
// Mode 2: Batch via TSeries
var tSeries = new TSeries(new List<long>(times), new List<double>(prices));
var batchResult = Rvi.Calculate(tSeries, stdevLength: 10, rmaLength: 14);
var batchResult = Rvi.Batch(tSeries, stdevLength: 10, rmaLength: 14);
// Mode 3: Span-based
double[] spanOutput = new double[dataLen];
@@ -636,7 +636,7 @@ public class RviTests
source.Add(new TValue(DateTime.UtcNow.AddSeconds(i), 100.0 + i * 0.5));
}
var result = Rvi.Calculate(source, stdevLength: 10, rmaLength: 14);
var result = Rvi.Batch(source, stdevLength: 10, rmaLength: 14);
Assert.Equal(50, result.Count);
// Allow small floating-point tolerance beyond [0,100]
@@ -654,7 +654,7 @@ public class RviTests
source.Add(new TBar(time, price - 1, price + 1, price - 2, price, 1000));
}
var result = Rvi.Calculate(source, stdevLength: 10, rmaLength: 14);
var result = Rvi.Batch(source, stdevLength: 10, rmaLength: 14);
Assert.Equal(50, result.Count);
}
+1 -1
View File
@@ -204,7 +204,7 @@ public class RviValidationTests
}
// Batch calculation
var batchResult = Rvi.Calculate(prices, 10, 14);
var batchResult = Rvi.Batch(prices, 10, 14);
// Compare last values
Assert.Equal(batchResult.Last.Value, streamingRvi.Last.Value, 8);
+11 -3
View File
@@ -370,7 +370,7 @@ public sealed class Rvi : AbstractBase
/// <param name="stdevLength">The lookback period for standard deviation.</param>
/// <param name="rmaLength">The lookback period for RMA smoothing.</param>
/// <returns>A TSeries containing the RVI values.</returns>
public static TSeries Calculate(TSeries source, int stdevLength = 10, int rmaLength = 14)
public static TSeries Batch(TSeries source, int stdevLength = 10, int rmaLength = 14)
{
if (stdevLength < 2)
{
@@ -399,7 +399,7 @@ public sealed class Rvi : AbstractBase
/// <summary>
/// Calculates RVI for a bar series (static).
/// </summary>
public static TSeries Calculate(TBarSeries source, int stdevLength = 10, int rmaLength = 14)
public static TSeries Batch(TBarSeries source, int stdevLength = 10, int rmaLength = 14)
{
var rvi = new Rvi(stdevLength, rmaLength);
return rvi.Update(source);
@@ -563,4 +563,12 @@ public sealed class Rvi : AbstractBase
output[i] = rviValue;
}
}
}
public static (TSeries Results, Rvi Indicator) Calculate(TSeries source, int stdevLength = 10, int rmaLength = 14)
{
var indicator = new Rvi(stdevLength, rmaLength);
TSeries results = indicator.Update(source);
return (results, indicator);
}
}