vertical guide

This commit is contained in:
Sewmina 2025-01-14 10:14:17 +05:30
parent 78524ae2d0
commit 077c1d21fc
2 changed files with 46 additions and 0 deletions

View File

@ -57,4 +57,45 @@ public static class Confirmations
return HeightIncrement; return HeightIncrement;
} }
public static List<decimal> GetResistanceLeevls(List<TAReport> reports, float tolerance = 0.1f, int steps = 5){
List<decimal> allResistances = new List<decimal>();
decimal highest = 0;
decimal lowest = 1000000000000000;
int lastMACross = 0;
for(int k =0; k < reports.Count; k++){
if(highest < reports[k].High){
highest = reports[k].High;
}
if(lowest > reports[k].Low){
lowest = reports[k].Low;
}
if(k <steps * 3){continue;} //not enough history
bool MATopNow = reports[k].SMA20 > reports[k].High;
bool MATopBefore = reports[k-1].SMA20 > reports[k-1].High;
bool MACrossed = MATopBefore!=MATopNow;
if(!MACrossed){continue;}//No cross
if(lastMACross == 0){
lastMACross = k;
continue; //First Cross
}
//Get lowest point between this and last cross
decimal lowestInPeriod = 1000000;
for(int i=k; i < lastMACross; i++ ){
if(reports[i].Low < lowestInPeriod){
lowestInPeriod=reports[i].Low;
}
}
allResistances.Add(lowestInPeriod);
}
return allResistances;
}
} }

View File

@ -78,6 +78,9 @@ public class Picasso{
PointF[] TWSPoints = bottomPoints; PointF[] TWSPoints = bottomPoints;
TWSPoints[1]-= new PointF(0,TWSHeightIncrement); TWSPoints[1]-= new PointF(0,TWSHeightIncrement);
img.Mutate(ctx=>ctx.DrawLine(TWSColor, 10, TWSPoints)); img.Mutate(ctx=>ctx.DrawLine(TWSColor, 10, TWSPoints));
img.Mutate(ctx=>ctx.DrawLine(Color.DarkGrey , 0.5f, [new PointF(i * widthMultiplier, 0),new PointF(i * widthMultiplier, height)])); //Draw Vertical guide
} }
#endregion #endregion
#region TBC #region TBC
@ -93,6 +96,8 @@ public class Picasso{
PointF[] TBCPoints = topPoints; PointF[] TBCPoints = topPoints;
TBCPoints[1]+= new PointF(0,TBCHeightIncremenet); TBCPoints[1]+= new PointF(0,TBCHeightIncremenet);
img.Mutate(ctx=>ctx.DrawLine(TBCColor, 10, TBCPoints)); img.Mutate(ctx=>ctx.DrawLine(TBCColor, 10, TBCPoints));
img.Mutate(ctx=>ctx.DrawLine(Color.DarkGrey , 0.5f, [new PointF(i * widthMultiplier, 0),new PointF(i * widthMultiplier, height)])); //Draw Vertical guide
} }
#endregion #endregion