diff --git a/Tests/test_Trady.cs b/Tests/test_Trady.cs index 00bacbab..ebf70c4e 100644 --- a/Tests/test_Trady.cs +++ b/Tests/test_Trady.cs @@ -11,7 +11,6 @@ public class TradyTests private readonly Random rnd; private readonly double range; private readonly int iterations; - private int period; private readonly int skip; private readonly IEnumerable Candles; @@ -39,7 +38,7 @@ public class TradyTests { for (int run = 0; run < iterations; run++) { - period = rnd.Next(50) + 5; + int period = rnd.Next(50) + 5; Sma ma = new(period); TSeries QL = new(); foreach (TBar item in feed) @@ -69,7 +68,7 @@ public class TradyTests { for (int run = 0; run < iterations; run++) { - period = rnd.Next(50) + 5; + int period = rnd.Next(50) + 5; Ema ma = new(period); TSeries QL = new(); foreach (TBar item in feed) diff --git a/Tests/test_Tulip.cs b/Tests/test_Tulip.cs index 4729e61b..174b4046 100644 --- a/Tests/test_Tulip.cs +++ b/Tests/test_Tulip.cs @@ -8,7 +8,6 @@ public class TulipTests private readonly GbmFeed feed; private readonly Random rnd; private readonly double range; - private int period; private readonly int iterations; private readonly double[] data; private readonly double[] outdata; @@ -32,7 +31,7 @@ public class TulipTests { for (int run = 0; run < iterations; run++) { - period = rnd.Next(50) + 5; + int period = rnd.Next(50) + 5; Sma ma = new(period); TSeries QL = new(); foreach (TBar item in feed) @@ -56,8 +55,7 @@ public class TulipTests { for (int run = 0; run < iterations; run++) { - period = rnd.Next(50) + 5; - period = 20; + int period = rnd.Next(30) + 5; Ema ma = new(period, useSma: false); TSeries QL = new(); foreach (TBar item in feed) diff --git a/Tests/test_talib.cs b/Tests/test_talib.cs index cd073b8e..dcd64c32 100644 --- a/Tests/test_talib.cs +++ b/Tests/test_talib.cs @@ -8,8 +8,7 @@ public class TAlibTests private readonly GbmFeed feed; private readonly Random rnd; private readonly double range; - private int period; - private readonly int iterations; + private readonly int iterations; private readonly double[] data; private readonly double[] TALIB; @@ -32,7 +31,7 @@ public class TAlibTests { for (int run = 0; run < iterations; run++) { - period = rnd.Next(50) + 5; + int period = rnd.Next(50) + 5; Sma ma = new(period); TSeries QL = new(); foreach (TBar item in feed) @@ -52,7 +51,7 @@ public class TAlibTests { for (int run = 0; run < iterations; run++) { - period = rnd.Next(50) + 5; + int period = rnd.Next(50) + 5; Ema ma = new(period, useSma: true); TSeries QL = new(); foreach (TBar item in feed) @@ -72,7 +71,7 @@ public class TAlibTests { for (int run = 0; run < iterations; run++) { - period = rnd.Next(50) + 5; + int period = rnd.Next(50) + 5; Dema ma = new(period); TSeries QL = new(); foreach (TBar item in feed) @@ -92,7 +91,7 @@ public class TAlibTests { for (int run = 0; run < iterations; run++) { - period = rnd.Next(50) + 5; + int period = rnd.Next(50) + 5; Tema ma = new(period); TSeries QL = new(); foreach (TBar item in feed) @@ -135,7 +134,7 @@ public class TAlibTests { 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); TSeries QL = new(); foreach (TBar item in feed) diff --git a/lib/volatility/Atr.cs b/lib/volatility/Atr.cs index f3167410..35a67a15 100644 --- a/lib/volatility/Atr.cs +++ b/lib/volatility/Atr.cs @@ -19,7 +19,7 @@ public class Atr : AbstractBarBase { /// /// Thrown when period is less than 1. /// - public Atr(int period) : base() { + public Atr(int period) { if (period < 1) { throw new ArgumentOutOfRangeException(nameof(period), "Period must be greater than or equal to 1."); } diff --git a/quantower/_IndicatorBase.cs b/quantower/_IndicatorBase.cs index 043fd9e1..3b0cae62 100644 --- a/quantower/_IndicatorBase.cs +++ b/quantower/_IndicatorBase.cs @@ -27,7 +27,7 @@ public abstract class IndicatorBase : 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)' @@ -37,7 +37,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator int IWatchlistIndicator.MinHistoryDepths => 0; - protected IndicatorBase() : base() + protected IndicatorBase() { OnBackGround = true; SeparateWindow = false; @@ -45,7 +45,6 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator Series = new(name: $"{Name}", color: Color.Yellow, width: 2, style: LineStyle.Solid); AddLineSeries(Series); - InitIndicator(); } protected virtual void InitIndicator() @@ -95,7 +94,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator { base.OnPaintChart(args); List allPoints = new List(); - if (CurrentChart == null) return; + if (CurrentChart == null) { return; } Graphics gr = args.Graphics; var mainWindow = this.CurrentChart.Windows[args.WindowIndex]; @@ -126,7 +125,7 @@ public abstract class IndicatorBase : 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 })