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
+26
View File
@@ -71,4 +71,30 @@ public sealed class MaeValidationTests : IDisposable
}
}
}
[Fact]
public void Mae_Correction_Recomputes()
{
var ind = new Mae(20);
// Build state well past warmup
for (int i = 0; i < 50; i++)
{
ind.Update(100.0 + i * 0.5, 98.0 + i * 0.5);
}
// Anchor bar
const double anchorActual = 125.0;
const double anchorPredicted = 123.0;
ind.Update(anchorActual, anchorPredicted, isNew: true);
double anchorResult = ind.Last.Value;
// Correction with dramatically different values — recompute must yield different result
ind.Update(anchorActual * 10, anchorPredicted * 10, isNew: false);
Assert.NotEqual(anchorResult, ind.Last.Value);
// Correction back to original — must exactly restore original result
ind.Update(anchorActual, anchorPredicted, isNew: false);
Assert.Equal(anchorResult, ind.Last.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("Mean Absolute Error (MAE)", "MAE")