From 7501578e4bd406d10982873c41839cbac77e1520 Mon Sep 17 00:00:00 2001 From: Josue Nina Date: Tue, 17 Dec 2024 10:38:42 -0500 Subject: [PATCH] Resolved review comments --- Algorithm/QCAlgorithm.Indicators.cs | 3 ++- Indicators/SqueezeMomentum.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Algorithm/QCAlgorithm.Indicators.cs b/Algorithm/QCAlgorithm.Indicators.cs index bb82218d1245..5a3b41179413 100644 --- a/Algorithm/QCAlgorithm.Indicators.cs +++ b/Algorithm/QCAlgorithm.Indicators.cs @@ -1964,7 +1964,8 @@ public SortinoRatio SORTINO(Symbol symbol, int sortinoPeriod, double minimumAcce /// Selects a value from the BaseData to send into the indicator. If null, defaults to the Value property of BaseData (x => x.Value). /// The configured Squeeze Momentum indicator. [DocumentationAttribute(Indicators)] - public SqueezeMomentum SM(Symbol symbol, int bollingerPeriod = 20, decimal bollingerMultiplier = 2m, int keltnerPeriod = 20, decimal keltnerMultiplier = 1.5m, Resolution? resolution = null, Func selector = null) + public SqueezeMomentum SM(Symbol symbol, int bollingerPeriod = 20, decimal bollingerMultiplier = 2m, int keltnerPeriod = 20, + decimal keltnerMultiplier = 1.5m, Resolution? resolution = null, Func selector = null) { var name = CreateIndicatorName(symbol, $"SM({bollingerPeriod}, {bollingerMultiplier}, {keltnerPeriod}, {keltnerMultiplier})", resolution); var squeezeMomentum = new SqueezeMomentum(name, bollingerPeriod, bollingerMultiplier, keltnerPeriod, keltnerMultiplier); diff --git a/Indicators/SqueezeMomentum.cs b/Indicators/SqueezeMomentum.cs index e2cdc7f63795..8256dbed0e1d 100644 --- a/Indicators/SqueezeMomentum.cs +++ b/Indicators/SqueezeMomentum.cs @@ -13,6 +13,7 @@ * limitations under the License. */ +using System; using QuantConnect.Data.Market; namespace QuantConnect.Indicators @@ -52,13 +53,14 @@ public SqueezeMomentum(string name, int bollingerPeriod, decimal bollingerMultip _bollingerBands = new BollingerBands(bollingerPeriod, bollingerMultiplier); _averageTrueRange = new AverageTrueRange(keltnerPeriod, MovingAverageType.Simple); _keltnerMultiplier = keltnerMultiplier; + WarmUpPeriod = Math.Max(bollingerPeriod, keltnerPeriod); } /// /// Gets the warm-up period required for the indicator to be ready. /// This is determined by the warm-up period of the Bollinger Bands indicator. /// - public int WarmUpPeriod => _bollingerBands.WarmUpPeriod; + public int WarmUpPeriod { get; } /// /// Indicates whether the indicator is ready and has enough data for computation.