Three black crows with some refactors
This commit is contained in:
parent
2a07769ba2
commit
37743d7349
|
|
@ -120,9 +120,12 @@ namespace SignalsTest
|
||||||
// triggers += "Price dropped\n";
|
// triggers += "Price dropped\n";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if(reports[reports.Count-2].TWS > 0){
|
if(reports[reports.Count-2].TWS > 1){
|
||||||
triggers += $"Three White Soldiers appeared";
|
triggers += $"Three White Soldiers appeared";
|
||||||
}
|
}
|
||||||
|
if(reports[reports.Count-2].TBC > 1){
|
||||||
|
triggers += $"Three Black Crows appeared";
|
||||||
|
}
|
||||||
|
|
||||||
if(triggers!= ""){
|
if(triggers!= ""){
|
||||||
Picasso.DrawChart(reports, max ,min, maxVol, symbol);
|
Picasso.DrawChart(reports, max ,min, maxVol, symbol);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ public static class CoinsList{
|
||||||
public static List<string> symbols= [
|
public static List<string> symbols= [
|
||||||
"BTCUSDT",
|
"BTCUSDT",
|
||||||
"ADAUSDT",
|
"ADAUSDT",
|
||||||
|
"AIXBTUSDT",
|
||||||
"XRPUSDT",
|
"XRPUSDT",
|
||||||
"XLMUSDT",
|
"XLMUSDT",
|
||||||
"SOLUSDT",
|
"SOLUSDT",
|
||||||
|
|
|
||||||
60
Confirmations.cs
Normal file
60
Confirmations.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
using SignalsTest;
|
||||||
|
|
||||||
|
public static class Confirmations
|
||||||
|
{
|
||||||
|
public static float GetTWSConfirmation(List<TAReport> reports, int i)
|
||||||
|
{
|
||||||
|
float TWSHeightIncrement = 0;
|
||||||
|
|
||||||
|
if (i > 22)
|
||||||
|
{
|
||||||
|
bool hasCrossedST = false;
|
||||||
|
bool hasCrossedMA = false;
|
||||||
|
for (int z = 0; z < 20; z++)
|
||||||
|
{
|
||||||
|
if (!reports[i - z].STUp && reports[i].STUp)
|
||||||
|
{
|
||||||
|
hasCrossedST = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reports[i - z].SMA20 < reports[i - z].Open && reports[i].SMA20 > reports[i].Open)
|
||||||
|
{
|
||||||
|
hasCrossedMA = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasCrossedMA) TWSHeightIncrement += 15;
|
||||||
|
if (hasCrossedST) TWSHeightIncrement += 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TWSHeightIncrement;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static float GetTBCConfirmation(List<TAReport> reports, int i)
|
||||||
|
{
|
||||||
|
float HeightIncrement = 0;
|
||||||
|
|
||||||
|
if (i > 22)
|
||||||
|
{
|
||||||
|
bool hasCrossedST = false;
|
||||||
|
bool hasCrossedMA = false;
|
||||||
|
for (int z = 0; z < 20; z++)
|
||||||
|
{
|
||||||
|
if (reports[i - z].STUp && !reports[i].STUp)
|
||||||
|
{
|
||||||
|
hasCrossedST = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reports[i - z].SMA20 > reports[i - z].Open && reports[i].SMA20 < reports[i].Open)
|
||||||
|
{
|
||||||
|
hasCrossedMA = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasCrossedMA) HeightIncrement += 15;
|
||||||
|
if (hasCrossedST) HeightIncrement += 15;
|
||||||
|
}
|
||||||
|
|
||||||
|
return HeightIncrement;
|
||||||
|
}
|
||||||
|
}
|
||||||
35
Patterns.cs
35
Patterns.cs
|
|
@ -84,6 +84,41 @@ public static class Patterns{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int GetThreeBlackCrows(List<KlineCandleStickResponse> responses, int curIndex){
|
||||||
|
if(curIndex < 10){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
KlineCandleStickResponse candle1 = responses[curIndex];
|
||||||
|
KlineCandleStickResponse candle2 = responses[curIndex-1];
|
||||||
|
KlineCandleStickResponse candle3 = responses[curIndex-2];
|
||||||
|
|
||||||
|
bool isAllRed = !candle1.isGreen() && !candle2.isGreen() && !candle3.isGreen();
|
||||||
|
|
||||||
|
//LP:using average shadow is a bad idea, check each shadow
|
||||||
|
// float averageShadowRatio = (candle1.getShadowRatio() + candle2.getShadowRatio() + candle3.getShadowRatio())/3f;
|
||||||
|
|
||||||
|
|
||||||
|
bool areSoldiers = AreAllSolid([candle1,candle2, candle3],0.6f);
|
||||||
|
bool areSoldiersThin = AreAllSolid([candle1,candle2, candle3], 0.4f);
|
||||||
|
|
||||||
|
|
||||||
|
bool areSameSize = AreSameCandleSizes([candle1,candle2,candle3]);
|
||||||
|
|
||||||
|
if(isAllRed && areSoldiers && areSameSize){
|
||||||
|
//Best
|
||||||
|
return 3;
|
||||||
|
}else if(isAllRed&& areSoldiersThin && areSameSize){
|
||||||
|
//Not strong
|
||||||
|
return 2;
|
||||||
|
}else if(isAllRed){
|
||||||
|
//Meh
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static bool AreSameCandleSizes(List<KlineCandleStickResponse> responses, float tolerance= 0.5f){
|
public static bool AreSameCandleSizes(List<KlineCandleStickResponse> responses, float tolerance= 0.5f){
|
||||||
float totalHeight = 0;
|
float totalHeight = 0;
|
||||||
|
|
|
||||||
53
Picasso.cs
53
Picasso.cs
|
|
@ -53,12 +53,19 @@ public class Picasso{
|
||||||
);
|
);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region TWS
|
|
||||||
|
|
||||||
|
|
||||||
|
float squareOffset = 2;
|
||||||
|
|
||||||
PointF[] bottomPoints = new PointF[2];
|
PointF[] bottomPoints = new PointF[2];
|
||||||
bottomPoints[0] = new PointF(i * widthMultiplier, lowVal+ candlesOffset);
|
bottomPoints[0] = new PointF(i * widthMultiplier, lowVal-squareOffset+ candlesOffset);
|
||||||
bottomPoints[1] = new PointF(i * widthMultiplier, lowVal- 15+ candlesOffset);
|
bottomPoints[1] = new PointF(i * widthMultiplier, lowVal- 15+ candlesOffset);
|
||||||
|
|
||||||
|
PointF[] topPoints = new PointF[2];
|
||||||
|
topPoints[0] = new PointF(i * widthMultiplier, highVal+squareOffset+ candlesOffset);
|
||||||
|
topPoints[1] = new PointF(i * widthMultiplier, highVal+15+ candlesOffset);
|
||||||
|
|
||||||
|
#region TWS
|
||||||
if(reports[i].TWS > 1){
|
if(reports[i].TWS > 1){
|
||||||
Color TWSColor = Color.Blue;
|
Color TWSColor = Color.Blue;
|
||||||
if(reports[i].TWS == 2){
|
if(reports[i].TWS == 2){
|
||||||
|
|
@ -66,30 +73,28 @@ public class Picasso{
|
||||||
}else if(reports[i].TWS== 3){
|
}else if(reports[i].TWS== 3){
|
||||||
TWSColor = Color.White;
|
TWSColor = Color.White;
|
||||||
}
|
}
|
||||||
|
float TWSHeightIncrement = Confirmations.GetTWSConfirmation(reports,i);
|
||||||
float TWSHeight = 15;
|
|
||||||
|
|
||||||
if(i > 22){
|
PointF[] TWSPoints = bottomPoints;
|
||||||
bool hasCrossedST = false;
|
TWSPoints[1]-= new PointF(0,TWSHeightIncrement);
|
||||||
bool hasCrossedMA = false;
|
img.Mutate(ctx=>ctx.DrawLine(TWSColor, 10, TWSPoints));
|
||||||
for(int z = 0; z < 20; z++){
|
|
||||||
if(!reports[i-z].STUp && reports[i].STUp){
|
|
||||||
hasCrossedST=true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(reports[i-z].SMA20 < reports[i-z].Open && reports[i].SMA20 > reports[i].Open){
|
|
||||||
hasCrossedMA=true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(hasCrossedMA) TWSHeight+=15;
|
|
||||||
if(hasCrossedST) TWSHeight+=15;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
img.Mutate(ctx=>ctx.DrawLine(TWSColor, TWSHeight, bottomPoints));
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
#region TBC
|
||||||
|
if(reports[i].TBC > 1){
|
||||||
|
Color TBCColor = Color.Red;
|
||||||
|
if(reports[i].TBC == 2){
|
||||||
|
TBCColor = Color.Cyan;
|
||||||
|
}else if(reports[i].TBC== 3){
|
||||||
|
TBCColor = Color.White;
|
||||||
|
}
|
||||||
|
float TBCHeightIncremenet = Confirmations.GetTBCConfirmation(reports,i);
|
||||||
|
|
||||||
|
PointF[] TBCPoints = topPoints;
|
||||||
|
TBCPoints[1]+= new PointF(0,TBCHeightIncremenet);
|
||||||
|
img.Mutate(ctx=>ctx.DrawLine(TBCColor, 10, TBCPoints));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
// Console.WriteLine("Getting paths");
|
// Console.WriteLine("Getting paths");
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ namespace SignalsTest
|
||||||
public decimal RSI = 0;
|
public decimal RSI = 0;
|
||||||
|
|
||||||
public int TWS =0;
|
public int TWS =0;
|
||||||
|
public int TBC = 0;
|
||||||
|
|
||||||
public bool STUp = false;
|
public bool STUp = false;
|
||||||
public bool TGOR=false;
|
public bool TGOR=false;
|
||||||
|
|
@ -140,7 +141,7 @@ namespace SignalsTest
|
||||||
|
|
||||||
report.TGOR= Patterns.GetTGOR(response, index);
|
report.TGOR= Patterns.GetTGOR(response, index);
|
||||||
report.TWS = Patterns.GetThreeWhiteSoldiers(response,index);
|
report.TWS = Patterns.GetThreeWhiteSoldiers(response,index);
|
||||||
|
report.TBC = Patterns.GetThreeBlackCrows(response, index);
|
||||||
|
|
||||||
|
|
||||||
return report;
|
return report;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user