From 3879266977768329b3eacb31d25de461059e48ce Mon Sep 17 00:00:00 2001 From: Miha Kralj Date: Mon, 30 Sep 2024 10:31:57 -0700 Subject: [PATCH] barbase --- quantower/_IndicatorBarBase.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/quantower/_IndicatorBarBase.cs b/quantower/_IndicatorBarBase.cs index ff1de4de..a5fae449 100644 --- a/quantower/_IndicatorBarBase.cs +++ b/quantower/_IndicatorBarBase.cs @@ -14,7 +14,7 @@ public abstract class IndicatorBarBase : Indicator, IWatchlistIndicator [InputParameter("Show cold values", sortIndex: 20)] public bool ShowColdValues { get; set; } = true; - public int MinHistoryDepths; + public int MinHistoryDepths { get; set; } // LineSeries.LineSeries(string, Color, int, LineStyle)' @@ -30,13 +30,9 @@ public abstract class IndicatorBarBase : Indicator, IWatchlistIndicator Series = new(name: $"{Name}", color: Color.RoyalBlue, width: 2, style: LineStyle.Solid); AddLineSeries(Series); - InitIndicator(); } - protected virtual void InitIndicator() - { - SourceName = GetName(Source); - } + protected abstract void InitIndicator(); protected override void OnInit() { @@ -64,7 +60,7 @@ public abstract class IndicatorBarBase : Indicator, IWatchlistIndicator { base.OnPaintChart(args); List allPoints = new List(); - if (CurrentChart == null) return; + if (CurrentChart == null) { return; } Graphics gr = args.Graphics; @@ -96,7 +92,7 @@ public abstract class IndicatorBarBase : Indicator, IWatchlistIndicator private void DrawSmoothCombinedCurve(Graphics gr, List allPoints, int hotCount) { - if (allPoints.Count < 2) return; + if (allPoints.Count < 2) { return; } using (Pen defaultPen = new(Series!.Color, Series.Width) { DashStyle = ConvertLineStyleToDashStyle(Series.Style) }) using (Pen coldPen = new(Series!.Color, Series.Width) { DashStyle = DashStyle.Dot }) @@ -116,7 +112,7 @@ public abstract class IndicatorBarBase : Indicator, IWatchlistIndicator } } } - private DashStyle ConvertLineStyleToDashStyle(LineStyle lineStyle) + private static DashStyle ConvertLineStyleToDashStyle(LineStyle lineStyle) { return lineStyle switch { @@ -127,7 +123,7 @@ public abstract class IndicatorBarBase : Indicator, IWatchlistIndicator _ => DashStyle.Solid, }; } - protected void DrawText(Graphics gr, string text, Rectangle clientRect) + protected static void DrawText(Graphics gr, string text, Rectangle clientRect) { Font font = new Font("Inter", 8); SizeF textSize = gr.MeasureString(text, font);