mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-23 13:08:04 +00:00
normalization of methods
This commit is contained in:
@@ -101,7 +101,7 @@ public class FramaTests
|
||||
var series = BuildSeries(60, seed: 21);
|
||||
double[] output = new double[series.Count];
|
||||
|
||||
Frama.Calculate(series.High.Values, series.Low.Values, period, output);
|
||||
Frama.Batch(series.High.Values, series.Low.Values, period, output);
|
||||
TSeries batch = FramaBatch(series, period);
|
||||
|
||||
for (int i = 0; i < series.Count; i++)
|
||||
|
||||
@@ -46,7 +46,7 @@ public class FramaValidationTests
|
||||
double[] reference = new double[series.Count];
|
||||
|
||||
ReferenceFrama(series.High.Values, series.Low.Values, period, reference);
|
||||
Frama.Calculate(series.High.Values, series.Low.Values, period, output);
|
||||
Frama.Batch(series.High.Values, series.Low.Values, period, output);
|
||||
|
||||
for (int i = 0; i < series.Count; i++)
|
||||
{
|
||||
|
||||
@@ -193,7 +193,7 @@ public sealed class Frama : ITValuePublisher, IDisposable
|
||||
int len = source.Count;
|
||||
var v = new double[len];
|
||||
|
||||
Calculate(source.High.Values, source.Low.Values, _periodEven, v);
|
||||
Batch(source.High.Values, source.Low.Values, _periodEven, v);
|
||||
|
||||
var tList = new List<long>(len);
|
||||
var times = source.Open.Times;
|
||||
@@ -242,7 +242,7 @@ public sealed class Frama : ITValuePublisher, IDisposable
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private void Handle(object? sender, in TValueEventArgs args) => Update(args.Value, args.IsNew);
|
||||
|
||||
public static void Calculate(ReadOnlySpan<double> high, ReadOnlySpan<double> low, int period, Span<double> output)
|
||||
public static void Batch(ReadOnlySpan<double> high, ReadOnlySpan<double> low, int period, Span<double> output)
|
||||
{
|
||||
if (high.Length != low.Length || high.Length != output.Length)
|
||||
{
|
||||
@@ -260,7 +260,7 @@ public sealed class Frama : ITValuePublisher, IDisposable
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Calculate(ReadOnlySpan<double> source, Span<double> output, int period)
|
||||
public static void Batch(ReadOnlySpan<double> source, Span<double> output, int period)
|
||||
{
|
||||
if (source.Length != output.Length)
|
||||
{
|
||||
@@ -286,7 +286,7 @@ public sealed class Frama : ITValuePublisher, IDisposable
|
||||
|
||||
int len = source.Count;
|
||||
var v = new double[len];
|
||||
Calculate(source.High.Values, source.Low.Values, period, v);
|
||||
Batch(source.High.Values, source.Low.Values, period, v);
|
||||
|
||||
var tList = new List<long>(len);
|
||||
var times = source.Open.Times;
|
||||
@@ -298,6 +298,13 @@ public sealed class Frama : ITValuePublisher, IDisposable
|
||||
return new TSeries(tList, [.. v]);
|
||||
}
|
||||
|
||||
public static (TSeries Results, Frama Indicator) Calculate(TBarSeries source, int period)
|
||||
{
|
||||
var indicator = new Frama(period);
|
||||
TSeries results = indicator.Update(source);
|
||||
return (results, indicator);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static double GetMax(RingBuffer buffer, int length, int startOffset = -1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user