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:
Miha Kralj
2026-03-09 13:45:46 -07:00
parent 8e43d62cbb
commit 031f1b5fe6
491 changed files with 6156 additions and 5590 deletions
@@ -241,4 +241,33 @@ public sealed class QqeValidationTests
Assert.NotEqual(ind1.QqeValue, ind2.QqeValue);
_output.WriteLine($"QQE(14,5,4.236)={ind1.QqeValue:F6} QQE(7,3,2)={ind2.QqeValue:F6}");
}
[Fact]
public void Qqe_Correction_Recomputes()
{
var ind = new Qqe();
var t0 = DateTime.MinValue;
// Build state well past warmup (WarmupPeriod ≈ 37)
for (int i = 0; i < 60; i++)
{
ind.Update(new TValue(t0.AddSeconds(i), 100.0 + i * 0.5));
}
// Anchor bar
var anchorTime = t0.AddSeconds(60);
const double anchorPrice = 130.0;
ind.Update(new TValue(anchorTime, anchorPrice), isNew: true);
double anchorQqe = ind.QqeValue;
double anchorSignal = ind.Signal;
// Use large downward spike (÷10) to move RSI away from ceiling
ind.Update(new TValue(anchorTime, anchorPrice / 10), isNew: false);
Assert.NotEqual(anchorQqe, ind.QqeValue);
// Correction back to original — both outputs must restore exactly
ind.Update(new TValue(anchorTime, anchorPrice), isNew: false);
Assert.Equal(anchorQqe, ind.QqeValue, 1e-9);
Assert.Equal(anchorSignal, ind.Signal, 1e-9);
}
}
+4
View File
@@ -278,6 +278,10 @@ public sealed class Qqe : AbstractBase
}
/// <summary>Span-based batch calculation (QQE line only).</summary>
/// <remarks>
/// Computes only the QQE line (EMA-smoothed RSI). The dynamic trailing <see cref="Signal"/> line
/// is not available from this API; use <see cref="Update(TValue, bool)"/> streaming to access both outputs.
/// </remarks>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Batch(ReadOnlySpan<double> source, Span<double> output,
int rsiPeriod = DefaultRsiPeriod,
+1 -1
View File
@@ -1,4 +1,4 @@
// The MIT License (MIT)
// Licensed under the Apache License, Version 2.0
// © mihakralj
//@version=6
indicator("Quantitative Qualitative Estimation (QQE)", "QQE", overlay=false)