Hammer patterns

This commit is contained in:
Sewmina 2025-01-19 12:14:09 +05:30
parent 22e80da4a5
commit 3219c51be3
4 changed files with 24 additions and 13 deletions

View File

@ -180,11 +180,17 @@ namespace SignalsTest
if (reports[reports.Count - 2].TWS > 1) 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) 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 != "") if (triggers != "")

View File

@ -30,9 +30,9 @@ public static class Confirmations
return TWSHeightIncrement; return TWSHeightIncrement;
} }
public static float GetTBCConfirmation(List<TAReport> reports, int i) public static int GetTBCConfirmation(List<TAReport> reports, int i)
{ {
float HeightIncrement = 0; int HeightIncrement = 0;
if (i > 22) if (i > 22)
{ {
@ -51,8 +51,8 @@ public static class Confirmations
} }
} }
if (hasCrossedMA) HeightIncrement += 15; if (hasCrossedMA) HeightIncrement += 1;
if (hasCrossedST) HeightIncrement += 15; if (hasCrossedST) HeightIncrement += 1;
} }
return HeightIncrement; return HeightIncrement;

View File

@ -107,7 +107,8 @@ public class Picasso{
} }
float TWSHeightIncrement = Confirmations.GetTWSConfirmation(reports,i); 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}"; string text = $"TWS{strengthText}";
// Position text below the candle // Position text below the candle
@ -128,7 +129,8 @@ public class Picasso{
} }
float TWSHeightIncrement = Confirmations.GetTBCConfirmation(reports,i); 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}"; string text = $"TBC{strengthText}";
// Position text above the candle // Position text above the candle
@ -140,17 +142,17 @@ public class Picasso{
#endregion #endregion
// Update hammer indicator position // 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); PointF squarePosition = new PointF(i * widthMultiplier - squareSize/2, lowVal - 40);
img.Mutate(ctx => ctx.Fill(Color.White, new RectangleF(squarePosition, new SizeF(squareSize, squareSize)))); img.Mutate(ctx => ctx.Fill(Color.White, new RectangleF(squarePosition, new SizeF(squareSize, squareSize))));
} }
// Update inverse hammer indicator position // 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); PointF squarePosition = new PointF(i * widthMultiplier - squareSize/2, highVal + 50);
img.Mutate(ctx => ctx.Fill(Color.White, new RectangleF(squarePosition, new SizeF(squareSize, squareSize)))); img.Mutate(ctx => ctx.Fill(Color.White, new RectangleF(squarePosition, new SizeF(squareSize, squareSize))));
} }

View File

@ -42,6 +42,8 @@ namespace SignalsTest
public int TWS =0; public int TWS =0;
public int TBC = 0; public int TBC = 0;
public bool isHammer,isInverseHammer = false;
public decimal Stochastic = 0; public decimal Stochastic = 0;
public decimal StochasticK3 = 0; public decimal StochasticK3 = 0;
@ -149,7 +151,8 @@ namespace SignalsTest
report.TWS = Patterns.GetThreeWhiteSoldiers(response,index); report.TWS = Patterns.GetThreeWhiteSoldiers(response,index);
report.TBC = Patterns.GetThreeBlackCrows(response, index); report.TBC = Patterns.GetThreeBlackCrows(response, index);
report.isHammer = Patterns.isHammer(response[index]);
report.isInverseHammer = Patterns.isInverseHammer(response[index]);
return report; return report;
} }