fix: address code review issues in indicators and core components

This commit is contained in:
Miha Kralj
2025-12-09 16:00:04 -05:00
parent 5e6e3a070e
commit c802a9ea80
12 changed files with 54 additions and 26 deletions
+5 -1
View File
@@ -26,6 +26,8 @@ namespace QuanTAlib;
public sealed class Alma : ITValuePublisher
{
private readonly int _period;
private readonly double _offset;
private readonly double _sigma;
private readonly double[] _weights;
private readonly double _weightSum;
private readonly RingBuffer _buffer;
@@ -62,6 +64,8 @@ public sealed class Alma : ITValuePublisher
throw new ArgumentException("Sigma must be greater than 0", nameof(sigma));
_period = period;
_offset = offset;
_sigma = sigma;
_buffer = new RingBuffer(period);
_weights = new double[period];
Name = $"Alma({period}, {offset:F2}, {sigma:F2})";
@@ -129,7 +133,7 @@ public sealed class Alma : ITValuePublisher
var tSpan = CollectionsMarshal.AsSpan(t);
var vSpan = CollectionsMarshal.AsSpan(v);
Calculate(source.Values, vSpan, _period);
Calculate(source.Values, vSpan, _period, _offset, _sigma);
source.Times.CopyTo(tSpan);
// Restore state