Afirma + documentation +semver: patch

This commit is contained in:
Miha Kralj
2024-09-24 16:41:26 -07:00
parent 07efb4b0de
commit 133c65ceaf
250 changed files with 14425 additions and 713 deletions
+13 -10
View File
@@ -3,11 +3,10 @@ using TradingPlatform.BusinessLayer;
using TradingPlatform.BusinessLayer.Chart;
using System.Runtime.CompilerServices;
using System.Drawing.Drawing2D;
using QuanTAlib;
using System.Collections;
using TradingPlatform.BusinessLayer.TimeSync;
namespace QuanTAlib;
#pragma warning disable CA1416 // Validate platform compatibility
public abstract class IndicatorBase : Indicator, IWatchlistIndicator
{
@@ -28,7 +27,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
[InputParameter("Show cold values", sortIndex: 20)]
public bool ShowColdValues { get; set; } = true;
public int MinHistoryDepths { get; set; }
public int MinHistoryDepths;
// LineSeries.LineSeries(string, Color, int, LineStyle)'
@@ -38,7 +37,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
int IWatchlistIndicator.MinHistoryDepths => 0;
protected IndicatorBase()
protected IndicatorBase() : base()
{
OnBackGround = true;
SeparateWindow = false;
@@ -46,9 +45,13 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
Series = new(name: $"{Name}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
InitIndicator();
}
protected abstract void InitIndicator();
protected virtual void InitIndicator()
{
SourceName = GetName(Source);
}
protected override void OnInit()
{
@@ -92,7 +95,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
{
base.OnPaintChart(args);
List<Point> allPoints = new List<Point>();
if (CurrentChart == null) { return; }
if (CurrentChart == null) return;
Graphics gr = args.Graphics;
var mainWindow = this.CurrentChart.Windows[args.WindowIndex];
@@ -123,7 +126,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
private void DrawSmoothCombinedCurve(Graphics gr, List<Point> 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 })
@@ -143,7 +146,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
}
}
}
private static DashStyle ConvertLineStyleToDashStyle(LineStyle lineStyle)
private DashStyle ConvertLineStyleToDashStyle(LineStyle lineStyle)
{
return lineStyle switch
{
@@ -154,7 +157,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
_ => DashStyle.Solid,
};
}
protected static void DrawText(Graphics gr, string text, Rectangle clientRect)
protected void DrawText(Graphics gr, string text, Rectangle clientRect)
{
Font font = new Font("Inter", 8);
SizeF textSize = gr.MeasureString(text, font);
@@ -164,7 +167,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
gr.FillRectangle(SystemBrushes.ControlDarkDark, textRect);
gr.DrawString(text, font, Brushes.White, new PointF(textRect.X + 6, textRect.Y + 5));
}
protected static string GetName(int pType)
protected string GetName(int pType)
{
return pType switch
{