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
+10 -3
View File
@@ -208,7 +208,7 @@ public sealed class Eom : ITValuePublisher
/// <param name="period">The smoothing period</param>
/// <param name="volumeScale">The volume scaling factor</param>
/// <returns>A TSeries containing the EOM values</returns>
public static TSeries Calculate(TBarSeries bars, int period = 14, double volumeScale = 10000)
public static TSeries Batch(TBarSeries bars, int period = 14, double volumeScale = 10000)
{
if (bars.Count == 0)
{
@@ -218,7 +218,7 @@ public sealed class Eom : ITValuePublisher
var t = bars.Open.Times.ToArray();
var v = new double[bars.Count];
Calculate(bars.High.Values, bars.Low.Values, bars.Volume.Values, v, period, volumeScale);
Batch(bars.High.Values, bars.Low.Values, bars.Volume.Values, v, period, volumeScale);
return new TSeries(t, v);
}
@@ -234,7 +234,7 @@ public sealed class Eom : ITValuePublisher
/// <param name="volumeScale">The volume scaling factor</param>
/// <exception cref="ArgumentException">Thrown when spans have different lengths</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Calculate(ReadOnlySpan<double> high, ReadOnlySpan<double> low,
public static void Batch(ReadOnlySpan<double> high, ReadOnlySpan<double> low,
ReadOnlySpan<double> volume, Span<double> output, int period = 14, double volumeScale = 10000)
{
if (high.Length != low.Length)
@@ -332,4 +332,11 @@ public sealed class Eom : ITValuePublisher
}
}
}
public static (TSeries Results, Eom Indicator) Calculate(TBarSeries bars, int period = 14, double volumeScale = 10000)
{
var indicator = new Eom(period, volumeScale);
TSeries results = indicator.Update(bars);
return (results, indicator);
}
}