From 077c1d21fc2546dc762b22251a85b3734f4188b2 Mon Sep 17 00:00:00 2001 From: Sewmina Date: Tue, 14 Jan 2025 10:14:17 +0530 Subject: [PATCH] vertical guide --- Confirmations.cs | 41 +++++++++++++++++++++++++++++++++++++++++ Picasso.cs | 5 +++++ 2 files changed, 46 insertions(+) diff --git a/Confirmations.cs b/Confirmations.cs index 6369bc8..7cd8f07 100644 --- a/Confirmations.cs +++ b/Confirmations.cs @@ -57,4 +57,45 @@ public static class Confirmations return HeightIncrement; } + + public static List GetResistanceLeevls(List reports, float tolerance = 0.1f, int steps = 5){ + List allResistances = new List(); + + 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 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; + } } \ No newline at end of file diff --git a/Picasso.cs b/Picasso.cs index 7e44eca..16a4ce5 100644 --- a/Picasso.cs +++ b/Picasso.cs @@ -78,6 +78,9 @@ public class Picasso{ PointF[] TWSPoints = bottomPoints; TWSPoints[1]-= new PointF(0,TWSHeightIncrement); 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 #region TBC @@ -93,6 +96,8 @@ public class Picasso{ PointF[] TBCPoints = topPoints; TBCPoints[1]+= new PointF(0,TBCHeightIncremenet); 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