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
@@ -679,4 +679,32 @@ public sealed class IchimokuValidationTests : IDisposable
}
#endregion
[Fact]
public void Ichimoku_Correction_Recomputes()
{
var ind = new Ichimoku();
var t0 = new DateTime(946_684_800_000_000_0L, DateTimeKind.Utc);
// Build state well past warmup
for (int i = 0; i < 100; i++)
{
double p = 100.0 + 10.0 * Math.Sin(2.0 * Math.PI * i / 20.0);
ind.Update(new TBar(t0.AddMinutes(i), p, p + 2, p - 2, p, 1000), isNew: true);
}
// Anchor bar
var anchorTime = t0.AddMinutes(100);
const double anchorClose = 105.5;
ind.Update(new TBar(anchorTime, anchorClose, anchorClose + 2, anchorClose - 2, anchorClose, 1000), isNew: true);
double anchorTenkan = ind.Tenkan.Value;
// Correction with a dramatically different price — Tenkan must change
ind.Update(new TBar(anchorTime, anchorClose * 10, (anchorClose + 2) * 10, (anchorClose - 2) * 10, anchorClose * 10, 1000), isNew: false);
Assert.NotEqual(anchorTenkan, ind.Tenkan.Value);
// Correction back to original price — must exactly restore original Tenkan
ind.Update(new TBar(anchorTime, anchorClose, anchorClose + 2, anchorClose - 2, anchorClose, 1000), isNew: false);
Assert.Equal(anchorTenkan, ind.Tenkan.Value, 1e-9);
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
// The MIT License (MIT)
// Licensed under the Apache License, Version 2.0
// © mihakralj
//@version=6
indicator("Ichimoku Cloud", "ICHIMOKU", overlay=true)