From e89af1d357b0e6061d3cd15d0c86e0a1a4de3303 Mon Sep 17 00:00:00 2001 From: Miha Kralj Date: Sat, 29 Nov 2025 21:25:55 -0800 Subject: [PATCH] feat: Add Name property to EMA, SMA, and WMA classes for better identification --- lib/averages/ema/Ema.cs | 7 +++++++ lib/averages/sma/Sma.cs | 6 ------ lib/averages/wma/Wma.cs | 6 ------ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/averages/ema/Ema.cs b/lib/averages/ema/Ema.cs index e7d1bd7d..ccb1f023 100644 --- a/lib/averages/ema/Ema.cs +++ b/lib/averages/ema/Ema.cs @@ -38,6 +38,11 @@ public class Ema private State _p_state = State.New(); private double _lastValidValue; + /// + /// Display name for the indicator. + /// + public string Name { get; } + /// /// Creates EMA with specified period. /// Alpha = 2 / (period + 1) @@ -49,6 +54,7 @@ public class Ema throw new ArgumentException("Period must be greater than 0", nameof(period)); _alpha = 2.0 / (period + 1); + Name = $"Ema({period})"; } /// @@ -61,6 +67,7 @@ public class Ema throw new ArgumentException("Alpha must be between 0 and 1", nameof(alpha)); _alpha = alpha; + Name = $"Ema(α={alpha:F4})"; } /// diff --git a/lib/averages/sma/Sma.cs b/lib/averages/sma/Sma.cs index 9721e891..66b51acb 100644 --- a/lib/averages/sma/Sma.cs +++ b/lib/averages/sma/Sma.cs @@ -47,11 +47,6 @@ public sealed class Sma /// public string Name { get; } - /// - /// Number of data points needed for the indicator to become "hot". - /// - public int WarmupPeriod { get; } - /// /// Creates SMA with specified period. /// @@ -64,7 +59,6 @@ public sealed class Sma _period = period; _buffer = new RingBuffer(period); Name = $"Sma({period})"; - WarmupPeriod = period; } /// diff --git a/lib/averages/wma/Wma.cs b/lib/averages/wma/Wma.cs index a2fe609c..bc516b14 100644 --- a/lib/averages/wma/Wma.cs +++ b/lib/averages/wma/Wma.cs @@ -55,11 +55,6 @@ public sealed class Wma /// public string Name { get; } - /// - /// Number of data points needed for the indicator to become "hot". - /// - public int WarmupPeriod { get; } - /// /// Creates WMA with specified period. /// @@ -73,7 +68,6 @@ public sealed class Wma _divisor = period * (period + 1) * 0.5; _buffer = new RingBuffer(period); Name = $"Wma({period})"; - WarmupPeriod = period; } ///