volume indicators

This commit is contained in:
Miha Kralj
2026-01-30 12:47:25 -08:00
parent 76d2b50cbb
commit 7b3a6520d2
99 changed files with 9539 additions and 283 deletions
+3 -2
View File
@@ -10,9 +10,10 @@ public class HemaTests
{
Assert.Throws<ArgumentOutOfRangeException>(() => new Hema(0));
Assert.Throws<ArgumentOutOfRangeException>(() => new Hema(-1));
Assert.Throws<ArgumentOutOfRangeException>(() => new Hema(1));
var hema = new Hema(1);
Assert.Equal("Hema(1)", hema.Name);
var hema = new Hema(2);
Assert.Equal("Hema(2)", hema.Name);
}
[Fact]
+2 -2
View File
@@ -75,9 +75,9 @@ public sealed class Hema : AbstractBase
public Hema(int period)
{
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(period);
ArgumentOutOfRangeException.ThrowIfLessThan(period, 2);
double n = Math.Max((double)period, 2.0);
double n = (double)period;
_alphaSlow = AlphaFromHalfLife(n);
_alphaFast = AlphaFromHalfLife(Math.Max(1.0, n * 0.5));
_alphaSmooth = AlphaFromHalfLife(Math.Max(1.0, Math.Sqrt(n)));