mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 05:48:06 +00:00
feat: add new indicators (Decay, Edecay, MinusDi, MinusDm, PlusDi, PlusDm, Maxindex, Minindex, Sarext) and update pine scripts, core libs, validation tests, and python bindings
This commit is contained in:
@@ -34,6 +34,7 @@ public sealed class Kendall : AbstractBase
|
||||
|
||||
private const double Epsilon = 1e-10;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool IsHot => _bufferX.Count >= 2;
|
||||
|
||||
/// <summary>
|
||||
@@ -88,16 +89,23 @@ public sealed class Kendall : AbstractBase
|
||||
/// <summary>
|
||||
/// Updates with raw double values.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Stamps both inputs with <c>DateTime.UtcNow</c> as their timestamp. For
|
||||
/// deterministic or replay-safe sequences use
|
||||
/// <see cref="Update(TValue, TValue, bool)"/> with explicit timestamps instead.
|
||||
/// </remarks>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public TValue Update(double seriesX, double seriesY, bool isNew = true)
|
||||
{
|
||||
return Update(new TValue(DateTime.UtcNow, seriesX), new TValue(DateTime.UtcNow, seriesY), isNew);
|
||||
}
|
||||
/// <summary>Not supported. This indicator requires two inputs; use <see cref="Update(TValue, TValue, bool)"/> instead.</summary>
|
||||
/// <remarks>Not supported for dual-input indicator. Use Update(seriesX, seriesY) instead.</remarks>
|
||||
public override TValue Update(TValue input, bool isNew = true)
|
||||
{
|
||||
throw new NotSupportedException("Kendall requires two inputs (seriesX and seriesY). Use Update(seriesX, seriesY).");
|
||||
}
|
||||
/// <summary>Not supported. This indicator requires two inputs; use <see cref="Batch(TSeries, TSeries, int)"/> instead.</summary>
|
||||
/// <remarks>Not supported for dual-input indicator. Use Batch(seriesX, seriesY, period) instead.</remarks>
|
||||
public override TSeries Update(TSeries source)
|
||||
{
|
||||
@@ -169,11 +177,13 @@ public sealed class Kendall : AbstractBase
|
||||
|
||||
return (concordant - discordant) / denominator;
|
||||
}
|
||||
/// <summary>Not supported. This indicator requires two input spans.</summary>
|
||||
public override void Prime(ReadOnlySpan<double> source, TimeSpan? step = null)
|
||||
{
|
||||
throw new NotSupportedException("Kendall requires two inputs.");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Reset()
|
||||
{
|
||||
_bufferX.Clear();
|
||||
@@ -268,6 +278,9 @@ public sealed class Kendall : AbstractBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calculates Kendall Tau-a for two time series and returns both the result series and the live indicator instance.
|
||||
/// </summary>
|
||||
public static (TSeries Results, Kendall Indicator) Calculate(TSeries seriesX, TSeries seriesY, int period = 20)
|
||||
{
|
||||
var indicator = new Kendall(period);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// The MIT License (MIT)
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// © mihakralj
|
||||
//@version=6
|
||||
indicator("Kendall Rank Correlation (KENDALL)", "KENDALL", overlay=false, precision=4)
|
||||
|
||||
Reference in New Issue
Block a user