diff --git a/Indicators/ChoppinessIndex.cs b/Indicators/ChoppinessIndex.cs
index b85b68affd4a..18c94199ed8d 100644
--- a/Indicators/ChoppinessIndex.cs
+++ b/Indicators/ChoppinessIndex.cs
@@ -46,10 +46,15 @@ public class ChoppinessIndex : BarIndicator, IIndicatorWarmUpPeriodProvider
/// Creates a new ChoppinessIndex indicator using the specified period and moving average type
///
/// The name of this indicator
- /// The period used for rolling windows for highs and lows
+ /// The period used for rolling windows for highs and lows, must be greater than one
public ChoppinessIndex(string name, int period)
: base(name)
{
+ if (period < 2)
+ {
+ throw new ArgumentException($"Period parameter for ChoppinessIndex indicator must be greater than 1 but was {period}");
+ }
+
_period = period;
_trueRange = new TrueRange();
@@ -64,7 +69,7 @@ public ChoppinessIndex(string name, int period)
///
/// Creates a new ChoppinessIndex indicator using the specified period
///
- /// The period used for rolling windows for highs and lows
+ /// The period used for rolling windows for highs and lows, must be greater than one
public ChoppinessIndex(int period)
: this($"CHOP({period})", period)
{
diff --git a/Tests/Indicators/ChoppinessIndexTests.cs b/Tests/Indicators/ChoppinessIndexTests.cs
index 48f20692606b..a3a07ad62591 100644
--- a/Tests/Indicators/ChoppinessIndexTests.cs
+++ b/Tests/Indicators/ChoppinessIndexTests.cs
@@ -13,6 +13,7 @@
* limitations under the License.
*/
+using System;
using NUnit.Framework;
using QuantConnect.Data.Market;
using QuantConnect.Indicators;
@@ -32,5 +33,14 @@ protected override IndicatorBase CreateIndicator()
protected override string TestFileName => "spy_with_chop.csv";
protected override string TestColumnName => "CHOP14";
+
+ [Test]
+ public void PeriodBelowMinimumThrows()
+ {
+ var period = 1;
+
+ var exception = Assert.Throws(() => new ChoppinessIndex(period));
+ Assert.That(exception.Message, Is.EqualTo($"Period parameter for ChoppinessIndex indicator must be greater than 1 but was {period}"));
+ }
}
}