mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-21 20:18:05 +00:00
normalization of methods
This commit is contained in:
+12
-5
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user