mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-22 12:38:06 +00:00
Code Scanning fixes
This commit is contained in:
+2
-3
@@ -11,7 +11,6 @@ public class TradyTests
|
|||||||
private readonly Random rnd;
|
private readonly Random rnd;
|
||||||
private readonly double range;
|
private readonly double range;
|
||||||
private readonly int iterations;
|
private readonly int iterations;
|
||||||
private int period;
|
|
||||||
private readonly int skip;
|
private readonly int skip;
|
||||||
private readonly IEnumerable<IOhlcv> Candles;
|
private readonly IEnumerable<IOhlcv> Candles;
|
||||||
|
|
||||||
@@ -39,7 +38,7 @@ public class TradyTests
|
|||||||
{
|
{
|
||||||
for (int run = 0; run < iterations; run++)
|
for (int run = 0; run < iterations; run++)
|
||||||
{
|
{
|
||||||
period = rnd.Next(50) + 5;
|
int period = rnd.Next(50) + 5;
|
||||||
Sma ma = new(period);
|
Sma ma = new(period);
|
||||||
TSeries QL = new();
|
TSeries QL = new();
|
||||||
foreach (TBar item in feed)
|
foreach (TBar item in feed)
|
||||||
@@ -69,7 +68,7 @@ public class TradyTests
|
|||||||
{
|
{
|
||||||
for (int run = 0; run < iterations; run++)
|
for (int run = 0; run < iterations; run++)
|
||||||
{
|
{
|
||||||
period = rnd.Next(50) + 5;
|
int period = rnd.Next(50) + 5;
|
||||||
Ema ma = new(period);
|
Ema ma = new(period);
|
||||||
TSeries QL = new();
|
TSeries QL = new();
|
||||||
foreach (TBar item in feed)
|
foreach (TBar item in feed)
|
||||||
|
|||||||
+2
-4
@@ -8,7 +8,6 @@ public class TulipTests
|
|||||||
private readonly GbmFeed feed;
|
private readonly GbmFeed feed;
|
||||||
private readonly Random rnd;
|
private readonly Random rnd;
|
||||||
private readonly double range;
|
private readonly double range;
|
||||||
private int period;
|
|
||||||
private readonly int iterations;
|
private readonly int iterations;
|
||||||
private readonly double[] data;
|
private readonly double[] data;
|
||||||
private readonly double[] outdata;
|
private readonly double[] outdata;
|
||||||
@@ -32,7 +31,7 @@ public class TulipTests
|
|||||||
{
|
{
|
||||||
for (int run = 0; run < iterations; run++)
|
for (int run = 0; run < iterations; run++)
|
||||||
{
|
{
|
||||||
period = rnd.Next(50) + 5;
|
int period = rnd.Next(50) + 5;
|
||||||
Sma ma = new(period);
|
Sma ma = new(period);
|
||||||
TSeries QL = new();
|
TSeries QL = new();
|
||||||
foreach (TBar item in feed)
|
foreach (TBar item in feed)
|
||||||
@@ -56,8 +55,7 @@ public class TulipTests
|
|||||||
{
|
{
|
||||||
for (int run = 0; run < iterations; run++)
|
for (int run = 0; run < iterations; run++)
|
||||||
{
|
{
|
||||||
period = rnd.Next(50) + 5;
|
int period = rnd.Next(30) + 5;
|
||||||
period = 20;
|
|
||||||
Ema ma = new(period, useSma: false);
|
Ema ma = new(period, useSma: false);
|
||||||
TSeries QL = new();
|
TSeries QL = new();
|
||||||
foreach (TBar item in feed)
|
foreach (TBar item in feed)
|
||||||
|
|||||||
+6
-7
@@ -8,8 +8,7 @@ public class TAlibTests
|
|||||||
private readonly GbmFeed feed;
|
private readonly GbmFeed feed;
|
||||||
private readonly Random rnd;
|
private readonly Random rnd;
|
||||||
private readonly double range;
|
private readonly double range;
|
||||||
private int period;
|
private readonly int iterations;
|
||||||
private readonly int iterations;
|
|
||||||
private readonly double[] data;
|
private readonly double[] data;
|
||||||
private readonly double[] TALIB;
|
private readonly double[] TALIB;
|
||||||
|
|
||||||
@@ -32,7 +31,7 @@ public class TAlibTests
|
|||||||
{
|
{
|
||||||
for (int run = 0; run < iterations; run++)
|
for (int run = 0; run < iterations; run++)
|
||||||
{
|
{
|
||||||
period = rnd.Next(50) + 5;
|
int period = rnd.Next(50) + 5;
|
||||||
Sma ma = new(period);
|
Sma ma = new(period);
|
||||||
TSeries QL = new();
|
TSeries QL = new();
|
||||||
foreach (TBar item in feed)
|
foreach (TBar item in feed)
|
||||||
@@ -52,7 +51,7 @@ public class TAlibTests
|
|||||||
{
|
{
|
||||||
for (int run = 0; run < iterations; run++)
|
for (int run = 0; run < iterations; run++)
|
||||||
{
|
{
|
||||||
period = rnd.Next(50) + 5;
|
int period = rnd.Next(50) + 5;
|
||||||
Ema ma = new(period, useSma: true);
|
Ema ma = new(period, useSma: true);
|
||||||
TSeries QL = new();
|
TSeries QL = new();
|
||||||
foreach (TBar item in feed)
|
foreach (TBar item in feed)
|
||||||
@@ -72,7 +71,7 @@ public class TAlibTests
|
|||||||
{
|
{
|
||||||
for (int run = 0; run < iterations; run++)
|
for (int run = 0; run < iterations; run++)
|
||||||
{
|
{
|
||||||
period = rnd.Next(50) + 5;
|
int period = rnd.Next(50) + 5;
|
||||||
Dema ma = new(period);
|
Dema ma = new(period);
|
||||||
TSeries QL = new();
|
TSeries QL = new();
|
||||||
foreach (TBar item in feed)
|
foreach (TBar item in feed)
|
||||||
@@ -92,7 +91,7 @@ public class TAlibTests
|
|||||||
{
|
{
|
||||||
for (int run = 0; run < iterations; run++)
|
for (int run = 0; run < iterations; run++)
|
||||||
{
|
{
|
||||||
period = rnd.Next(50) + 5;
|
int period = rnd.Next(50) + 5;
|
||||||
Tema ma = new(period);
|
Tema ma = new(period);
|
||||||
TSeries QL = new();
|
TSeries QL = new();
|
||||||
foreach (TBar item in feed)
|
foreach (TBar item in feed)
|
||||||
@@ -135,7 +134,7 @@ public class TAlibTests
|
|||||||
{
|
{
|
||||||
for (int run = 0; run < iterations; run++)
|
for (int run = 0; run < iterations; run++)
|
||||||
{
|
{
|
||||||
period = rnd.Next(50) + 5;
|
int period = rnd.Next(50) + 5;
|
||||||
T3 ma = new(period, vfactor: 0.7, useSma: false);
|
T3 ma = new(period, vfactor: 0.7, useSma: false);
|
||||||
TSeries QL = new();
|
TSeries QL = new();
|
||||||
foreach (TBar item in feed)
|
foreach (TBar item in feed)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class Atr : AbstractBarBase {
|
|||||||
/// <exception cref="ArgumentOutOfRangeException">
|
/// <exception cref="ArgumentOutOfRangeException">
|
||||||
/// Thrown when period is less than 1.
|
/// Thrown when period is less than 1.
|
||||||
/// </exception>
|
/// </exception>
|
||||||
public Atr(int period) : base() {
|
public Atr(int period) {
|
||||||
if (period < 1) {
|
if (period < 1) {
|
||||||
throw new ArgumentOutOfRangeException(nameof(period), "Period must be greater than or equal to 1.");
|
throw new ArgumentOutOfRangeException(nameof(period), "Period must be greater than or equal to 1.");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
|||||||
|
|
||||||
[InputParameter("Show cold values", sortIndex: 20)]
|
[InputParameter("Show cold values", sortIndex: 20)]
|
||||||
public bool ShowColdValues { get; set; } = true;
|
public bool ShowColdValues { get; set; } = true;
|
||||||
public int MinHistoryDepths;
|
public int MinHistoryDepths { get; set; }
|
||||||
|
|
||||||
// LineSeries.LineSeries(string, Color, int, LineStyle)'
|
// LineSeries.LineSeries(string, Color, int, LineStyle)'
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
|||||||
|
|
||||||
int IWatchlistIndicator.MinHistoryDepths => 0;
|
int IWatchlistIndicator.MinHistoryDepths => 0;
|
||||||
|
|
||||||
protected IndicatorBase() : base()
|
protected IndicatorBase()
|
||||||
{
|
{
|
||||||
OnBackGround = true;
|
OnBackGround = true;
|
||||||
SeparateWindow = false;
|
SeparateWindow = false;
|
||||||
@@ -45,7 +45,6 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
|||||||
Series = new(name: $"{Name}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
|
Series = new(name: $"{Name}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
|
||||||
|
|
||||||
AddLineSeries(Series);
|
AddLineSeries(Series);
|
||||||
InitIndicator();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void InitIndicator()
|
protected virtual void InitIndicator()
|
||||||
@@ -95,7 +94,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
|||||||
{
|
{
|
||||||
base.OnPaintChart(args);
|
base.OnPaintChart(args);
|
||||||
List<Point> allPoints = new List<Point>();
|
List<Point> allPoints = new List<Point>();
|
||||||
if (CurrentChart == null) return;
|
if (CurrentChart == null) { return; }
|
||||||
|
|
||||||
Graphics gr = args.Graphics;
|
Graphics gr = args.Graphics;
|
||||||
var mainWindow = this.CurrentChart.Windows[args.WindowIndex];
|
var mainWindow = this.CurrentChart.Windows[args.WindowIndex];
|
||||||
@@ -126,7 +125,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
|||||||
|
|
||||||
private void DrawSmoothCombinedCurve(Graphics gr, List<Point> allPoints, int hotCount)
|
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 defaultPen = new(Series!.Color, Series.Width) { DashStyle = ConvertLineStyleToDashStyle(Series.Style) })
|
||||||
using (Pen coldPen = new(Series!.Color, Series.Width) { DashStyle = DashStyle.Dot })
|
using (Pen coldPen = new(Series!.Color, Series.Width) { DashStyle = DashStyle.Dot })
|
||||||
|
|||||||
Reference in New Issue
Block a user