mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 22:08:05 +00:00
normalization of methods
This commit is contained in:
+10
-3
@@ -181,7 +181,7 @@ public sealed class Nvi : ITValuePublisher
|
||||
return new TSeries(t, v);
|
||||
}
|
||||
|
||||
public static TSeries Calculate(TBarSeries source, double startValue = 100.0)
|
||||
public static TSeries Batch(TBarSeries source, double startValue = 100.0)
|
||||
{
|
||||
if (source.Count == 0)
|
||||
{
|
||||
@@ -191,13 +191,13 @@ public sealed class Nvi : ITValuePublisher
|
||||
var t = source.Open.Times.ToArray();
|
||||
var v = new double[source.Count];
|
||||
|
||||
Calculate(source.Close.Values, source.Volume.Values, v, startValue);
|
||||
Batch(source.Close.Values, source.Volume.Values, v, startValue);
|
||||
|
||||
return new TSeries(t, v);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Calculate(ReadOnlySpan<double> close, ReadOnlySpan<double> volume, Span<double> output, double startValue = 100.0)
|
||||
public static void Batch(ReadOnlySpan<double> close, ReadOnlySpan<double> volume, Span<double> output, double startValue = 100.0)
|
||||
{
|
||||
if (close.Length != volume.Length)
|
||||
{
|
||||
@@ -273,4 +273,11 @@ public sealed class Nvi : ITValuePublisher
|
||||
prevVolume = currentVolume;
|
||||
}
|
||||
}
|
||||
|
||||
public static (TSeries Results, Nvi Indicator) Calculate(TBarSeries source, double startValue = 100.0)
|
||||
{
|
||||
var indicator = new Nvi(startValue);
|
||||
TSeries results = indicator.Update(source);
|
||||
return (results, indicator);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user