From 8755e0f979cc36bcc256eca09d24b5127a1445a4 Mon Sep 17 00:00:00 2001 From: Dave Skender <8432125+DaveSkender@users.noreply.github.com> Date: Sat, 18 Feb 2023 22:31:29 -0500 Subject: [PATCH 1/2] update PSAR validation --- src/m-r/ParabolicSar/ParabolicSar.Series.cs | 6 +++--- tests/indicators/m-r/ParabolicSar/ParabolicSar.Tests.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/m-r/ParabolicSar/ParabolicSar.Series.cs b/src/m-r/ParabolicSar/ParabolicSar.Series.cs index 58f2f3a73..f4c2b69d7 100644 --- a/src/m-r/ParabolicSar/ParabolicSar.Series.cs +++ b/src/m-r/ParabolicSar/ParabolicSar.Series.cs @@ -183,16 +183,16 @@ private static void ValidateParabolicSar( { string message = string.Format( EnglishCulture, - "Acceleration Step must be smaller than provided Max Acceleration Factor ({0}) for Parabolic SAR.", + "Acceleration Step cannot be larger than the Max Acceleration Factor ({0}) for Parabolic SAR.", maxAccelerationFactor); throw new ArgumentOutOfRangeException(nameof(accelerationStep), accelerationStep, message); } - if (initialFactor <= 0 || initialFactor >= maxAccelerationFactor) + if (initialFactor <= 0 || initialFactor > maxAccelerationFactor) { throw new ArgumentOutOfRangeException(nameof(initialFactor), initialFactor, - "Initial Step must be greater than 0 and less than Max Acceleration Factor for Parabolic SAR."); + "Initial Factor must be greater than 0 and not larger than Max Acceleration Factor for Parabolic SAR."); } } } diff --git a/tests/indicators/m-r/ParabolicSar/ParabolicSar.Tests.cs b/tests/indicators/m-r/ParabolicSar/ParabolicSar.Tests.cs index 41f33e60a..93928244c 100644 --- a/tests/indicators/m-r/ParabolicSar/ParabolicSar.Tests.cs +++ b/tests/indicators/m-r/ParabolicSar/ParabolicSar.Tests.cs @@ -114,7 +114,7 @@ public void InsufficientQuotes() public void BadData() { List r = badQuotes - .GetParabolicSar() + .GetParabolicSar(0.2, 0.2, 0.2) .ToList(); Assert.AreEqual(502, r.Count); From 8e60faf805348ffb390a8653cf9af0cb7706374d Mon Sep 17 00:00:00 2001 From: Dave Skender <8432125+DaveSkender@users.noreply.github.com> Date: Sat, 18 Feb 2023 22:35:41 -0500 Subject: [PATCH 2/2] update docs --- docs/_indicators/ParabolicSar.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_indicators/ParabolicSar.md b/docs/_indicators/ParabolicSar.md index 65c5aa056..9e1cc37a6 100644 --- a/docs/_indicators/ParabolicSar.md +++ b/docs/_indicators/ParabolicSar.md @@ -30,7 +30,7 @@ IEnumerable results = **`maxAccelerationFactor`** _`double`_ - Maximum factor limit. Must be greater than `accelerationStep`. Default is 0.2 -**`initialFactor`** _`double`_ - Optional. Initial Acceleration Factor. Must be greater than 0. Default is `accelerationStep`. +**`initialFactor`** _`double`_ - Optional. Initial Acceleration Factor. Must be greater than 0 and not larger than `maxAccelerationFactor`. Default is `accelerationStep`. ### Historical quotes requirements