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
+12 -5
View File
@@ -166,7 +166,7 @@ public sealed class Dmx : ITValuePublisher
var vSpan = CollectionsMarshal.AsSpan(v);
// Span-based batch calculation
Calculate(source.High.Values, source.Low.Values, source.Close.Values, _period, vSpan);
Batch(source.High.Values, source.Low.Values, source.Close.Values, _period, vSpan);
source.Close.Times.CopyTo(tSpan);
// Restore streaming state by replaying only tail bars (JMA needs ~2*period for full warmup)
@@ -182,7 +182,7 @@ public sealed class Dmx : ITValuePublisher
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Calculate(ReadOnlySpan<double> high,
public static void Batch(ReadOnlySpan<double> high,
ReadOnlySpan<double> low,
ReadOnlySpan<double> close,
int period,
@@ -271,9 +271,9 @@ public sealed class Dmx : ITValuePublisher
tr[i] = trRaw;
}
Jma.Calculate(dmPlus, dmPlusSmooth, period);
Jma.Calculate(dmMinus, dmMinusSmooth, period);
Jma.Calculate(tr, trSmooth, period);
Jma.Batch(dmPlus, dmPlusSmooth, period);
Jma.Batch(dmMinus, dmMinusSmooth, period);
Jma.Batch(tr, trSmooth, period);
for (int i = 0; i < len; i++)
{
@@ -304,4 +304,11 @@ public sealed class Dmx : ITValuePublisher
var dmx = new Dmx(period);
return dmx.Update(source);
}
public static (TSeries Results, Dmx Indicator) Calculate(TBarSeries source, int period = 14)
{
var indicator = new Dmx(period);
TSeries results = indicator.Update(source);
return (results, indicator);
}
}