From 5fb553976433eba1dbc313a5fc804bb1759934e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Dro=C5=84?= Date: Fri, 11 Aug 2023 17:33:14 +0200 Subject: [PATCH] fix: opening within previous candle conditions --- src/TechnicalAnalysis.Candles/Candle2Crows/Candle2Crows.cs | 2 +- .../Candle3BlackCrows/Candle3BlackCrows.cs | 4 ++-- .../Candle3Outside/Candle3Outside.cs | 4 ++-- .../Candle3StarsInSouth/Candle3StarsInSouth.cs | 2 +- .../CandleEngulfing/CandleEngulfing.cs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/TechnicalAnalysis.Candles/Candle2Crows/Candle2Crows.cs b/src/TechnicalAnalysis.Candles/Candle2Crows/Candle2Crows.cs index 535ac891..b3faba05 100644 --- a/src/TechnicalAnalysis.Candles/Candle2Crows/Candle2Crows.cs +++ b/src/TechnicalAnalysis.Candles/Candle2Crows/Candle2Crows.cs @@ -135,7 +135,7 @@ public override bool GetPatternRecognition(int i) // 3rd: black IsColorRed(i) && // opening within 2nd rb - Open[i] < Open[i - 1] && Open[i] > Close[i - 1] && + Open[i] < Open[i - 1] && Open[i] >= Close[i - 1] && // closing within 1st rb Close[i] > Open[i - 2] && Close[i] < Close[i - 2]; diff --git a/src/TechnicalAnalysis.Candles/Candle3BlackCrows/Candle3BlackCrows.cs b/src/TechnicalAnalysis.Candles/Candle3BlackCrows/Candle3BlackCrows.cs index deb9863e..a323a906 100644 --- a/src/TechnicalAnalysis.Candles/Candle3BlackCrows/Candle3BlackCrows.cs +++ b/src/TechnicalAnalysis.Candles/Candle3BlackCrows/Candle3BlackCrows.cs @@ -142,10 +142,10 @@ public override bool GetPatternRecognition(int i) GetLowerShadow(i) < GetCandleAverage(ShadowVeryShort, _shadowVeryShortPeriodTotal[0], i) && // 2nd black opens within 1st black's rb Open[i - 1] < Open[i - 2] && - Open[i - 1] > Close[i - 2] && + Open[i - 1] >= Close[i - 2] && // 3rd black opens within 2nd black's rb Open[i] < Open[i - 1] && - Open[i] > Close[i - 1] && + Open[i] >= Close[i - 1] && // 1st black closes under prior candle's high High[i - 3] > Close[i - 2] && // three declining diff --git a/src/TechnicalAnalysis.Candles/Candle3Outside/Candle3Outside.cs b/src/TechnicalAnalysis.Candles/Candle3Outside/Candle3Outside.cs index 86f43e74..a58bbd8a 100644 --- a/src/TechnicalAnalysis.Candles/Candle3Outside/Candle3Outside.cs +++ b/src/TechnicalAnalysis.Candles/Candle3Outside/Candle3Outside.cs @@ -106,7 +106,7 @@ public override bool GetPatternRecognition(int i) IsColorGreen(i - 1) && IsColorRed(i - 2) && Close[i - 1] > Open[i - 2] && - Open[i - 1] < Close[i - 2] && + Open[i - 1] <= Close[i - 2] && // third candle higher Close[i] > Close[i - 1] ) @@ -115,7 +115,7 @@ public override bool GetPatternRecognition(int i) // black engulfs white IsColorRed(i - 1) && IsColorGreen(i - 2) && - Open[i - 1] > Close[i - 2] && + Open[i - 1] >= Close[i - 2] && Close[i - 1] < Open[i - 2] && // third candle lower Close[i] < Close[i - 1] diff --git a/src/TechnicalAnalysis.Candles/Candle3StarsInSouth/Candle3StarsInSouth.cs b/src/TechnicalAnalysis.Candles/Candle3StarsInSouth/Candle3StarsInSouth.cs index f6f3fe43..ac4c279f 100644 --- a/src/TechnicalAnalysis.Candles/Candle3StarsInSouth/Candle3StarsInSouth.cs +++ b/src/TechnicalAnalysis.Candles/Candle3StarsInSouth/Candle3StarsInSouth.cs @@ -183,7 +183,7 @@ public override bool GetPatternRecognition(int i) // 2nd: smaller candle GetRealBody(i - 1) < GetRealBody(i - 2) && // that opens higher but within 1st range - Open[i - 1] > Close[i - 2] && + Open[i - 1] >= Close[i - 2] && Open[i - 1] <= High[i - 2] && // and trades lower than 1st close Low[i - 1] < Close[i - 2] && diff --git a/src/TechnicalAnalysis.Candles/CandleEngulfing/CandleEngulfing.cs b/src/TechnicalAnalysis.Candles/CandleEngulfing/CandleEngulfing.cs index a08559ab..734a6e3a 100644 --- a/src/TechnicalAnalysis.Candles/CandleEngulfing/CandleEngulfing.cs +++ b/src/TechnicalAnalysis.Candles/CandleEngulfing/CandleEngulfing.cs @@ -105,14 +105,14 @@ public override bool GetPatternRecognition(int i) IsColorGreen(i) && IsColorRed(i - 1) && Close[i] > Open[i - 1] && - Open[i] < Close[i - 1] + Open[i] <= Close[i - 1] ) || ( // black engulfs white IsColorRed(i) && IsColorGreen(i - 1) && - Open[i] > Close[i - 1] && + Open[i] >= Close[i - 1] && Close[i] < Open[i - 1] );