From 3219c51be3da7da68e81e0caaef4a77dd9287d67 Mon Sep 17 00:00:00 2001 From: Sewmina Date: Sun, 19 Jan 2025 12:14:09 +0530 Subject: [PATCH] Hammer patterns --- CoinWatch.cs | 10 ++++++++-- Confirmations.cs | 8 ++++---- Picasso.cs | 14 ++++++++------ TAReport.cs | 5 ++++- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/CoinWatch.cs b/CoinWatch.cs index 1689d8e..decdcbe 100644 --- a/CoinWatch.cs +++ b/CoinWatch.cs @@ -180,11 +180,17 @@ namespace SignalsTest if (reports[reports.Count - 2].TWS > 1) { - triggers += $"Three White Soldiers appeared"; + triggers += $"Three White Soldiers appeared\n"; } if (reports[reports.Count - 2].TBC > 1) { - triggers += $"Three Black Crows appeared"; + triggers += $"Three Black Crows appeared\n"; + } + if(reports[reports.Count-2].isHammer){ + triggers+=$"Hammer candle appeared\n"; + } + if(reports[reports.Count-2].isInverseHammer){ + triggers+=$"Inverse Hammer candle appeared\n"; } if (triggers != "") diff --git a/Confirmations.cs b/Confirmations.cs index 8398ee7..0a18088 100644 --- a/Confirmations.cs +++ b/Confirmations.cs @@ -30,9 +30,9 @@ public static class Confirmations return TWSHeightIncrement; } - public static float GetTBCConfirmation(List reports, int i) + public static int GetTBCConfirmation(List reports, int i) { - float HeightIncrement = 0; + int HeightIncrement = 0; if (i > 22) { @@ -51,8 +51,8 @@ public static class Confirmations } } - if (hasCrossedMA) HeightIncrement += 15; - if (hasCrossedST) HeightIncrement += 15; + if (hasCrossedMA) HeightIncrement += 1; + if (hasCrossedST) HeightIncrement += 1; } return HeightIncrement; diff --git a/Picasso.cs b/Picasso.cs index 00cd6ce..82095c9 100644 --- a/Picasso.cs +++ b/Picasso.cs @@ -107,7 +107,8 @@ public class Picasso{ } float TWSHeightIncrement = Confirmations.GetTWSConfirmation(reports,i); - string strengthText = reports[i].TWS == 3 ? "+2" : "+1"; + string strengthText = $"+{TWSHeightIncrement}"; + if(TWSHeightIncrement==0){strengthText="";} string text = $"TWS{strengthText}"; // Position text below the candle @@ -128,7 +129,8 @@ public class Picasso{ } float TWSHeightIncrement = Confirmations.GetTBCConfirmation(reports,i); - string strengthText = reports[i].TBC == 3 ? "+2" : "+1"; + string strengthText = $"+{TWSHeightIncrement}"; + if(TWSHeightIncrement==0){strengthText="";} string text = $"TBC{strengthText}"; // Position text above the candle @@ -140,17 +142,17 @@ public class Picasso{ #endregion // Update hammer indicator position - if (Patterns.isHammer(reports[i].candle)) + if (reports[i].isHammer) { - float squareSize = 10f; + float squareSize = 3f; PointF squarePosition = new PointF(i * widthMultiplier - squareSize/2, lowVal - 40); img.Mutate(ctx => ctx.Fill(Color.White, new RectangleF(squarePosition, new SizeF(squareSize, squareSize)))); } // Update inverse hammer indicator position - if (Patterns.isInverseHammer(reports[i].candle)) + if (reports[i].isInverseHammer) { - float squareSize = 10f; + float squareSize = 3f; PointF squarePosition = new PointF(i * widthMultiplier - squareSize/2, highVal + 50); img.Mutate(ctx => ctx.Fill(Color.White, new RectangleF(squarePosition, new SizeF(squareSize, squareSize)))); } diff --git a/TAReport.cs b/TAReport.cs index 5b95fc0..320e614 100644 --- a/TAReport.cs +++ b/TAReport.cs @@ -42,6 +42,8 @@ namespace SignalsTest public int TWS =0; public int TBC = 0; + public bool isHammer,isInverseHammer = false; + public decimal Stochastic = 0; public decimal StochasticK3 = 0; @@ -149,7 +151,8 @@ namespace SignalsTest report.TWS = Patterns.GetThreeWhiteSoldiers(response,index); report.TBC = Patterns.GetThreeBlackCrows(response, index); - + report.isHammer = Patterns.isHammer(response[index]); + report.isInverseHammer = Patterns.isInverseHammer(response[index]); return report; }