From 5bcdf8d6140d7b7a4b31156093b71ee9cd3a43ff Mon Sep 17 00:00:00 2001 From: Miha Kralj Date: Fri, 8 Nov 2024 17:11:18 -0800 Subject: [PATCH] Periods -> Period, DataSource attribute --- quantower/Averages/AfirmaIndicator.cs | 25 +++++------------ quantower/Averages/AlmaIndicator.cs | 13 +-------- quantower/Averages/DemaIndicator.cs | 13 +-------- quantower/Averages/DsmaIndicator.cs | 13 +-------- quantower/Averages/DwmaIndicator.cs | 13 +-------- quantower/Averages/EmaIndicator.cs | 25 +++++------------ quantower/Averages/EpmaIndicator.cs | 25 +++++------------ quantower/Averages/FramaIndicator.cs | 25 +++++------------ quantower/Averages/FwmaIndicator.cs | 25 +++++------------ quantower/Averages/GmaIndicator.cs | 25 +++++------------ quantower/Averages/HmaIndicator.cs | 25 +++++------------ quantower/Averages/HtitIndicator.cs | 13 +-------- quantower/Averages/HwmaIndicator.cs | 27 ++++++------------- quantower/Averages/JmaIndicator.cs | 25 +++++------------ quantower/Averages/KamaIndicator.cs | 25 +++++------------ quantower/Averages/LtmaIndicator.cs | 13 +-------- quantower/Averages/MaafIndicator.cs | 25 +++++------------ quantower/Averages/MamaIndicator.cs | 13 +-------- quantower/Averages/MgdiIndicator.cs | 25 +++++------------ quantower/Averages/MmaIndicator.cs | 25 +++++------------ quantower/Averages/PwmaIndicator.cs | 25 +++++------------ quantower/Averages/RemaIndicator.cs | 25 +++++------------ quantower/Averages/RmaIndicator.cs | 25 +++++------------ quantower/Averages/SinemaIndicator.cs | 25 +++++------------ quantower/Averages/SmaIndicator.cs | 13 +-------- quantower/Averages/SmmaIndicator.cs | 25 +++++------------ quantower/Averages/T3Indicator.cs | 25 +++++------------ quantower/Averages/TemaIndicator.cs | 25 +++++------------ quantower/Averages/TrimaIndicator.cs | 25 +++++------------ quantower/Averages/VidyaIndicator.cs | 15 ++--------- quantower/Averages/WmaIndicator.cs | 25 +++++------------ quantower/Averages/ZlemaIndicator.cs | 27 ++++++------------- quantower/Experiments/ConvolutionIndicator.cs | 13 +-------- quantower/Experiments/QemaIndicator.cs | 13 +-------- quantower/Experiments/TestIndicator.cs | 13 +-------- quantower/IndicatorExtensions.cs | 20 ++++++++++++++ quantower/Momentum/AdxIndicator.cs | 12 ++++----- quantower/Momentum/AdxrIndicator.cs | 12 ++++----- quantower/Momentum/ApoIndicator.cs | 13 +-------- quantower/Momentum/DmiIndicator.cs | 16 +++++------ quantower/Momentum/DmxIndicator.cs | 20 +++++++------- quantower/Momentum/DpoIndicator.cs | 13 +-------- quantower/Momentum/MacdIndicator.cs | 13 +-------- quantower/Momentum/MomIndicator.cs | 13 +-------- quantower/Momentum/PmoIndicator.cs | 13 +-------- quantower/Momentum/PoIndicator.cs | 13 +-------- quantower/Momentum/PpoIndicator.cs | 13 +-------- quantower/Momentum/RocIndicator.cs | 13 +-------- quantower/Momentum/TrixIndicator.cs | 13 +-------- quantower/Momentum/VelIndicator.cs | 13 +-------- quantower/Momentum/VortexIndicator.cs | 16 +++++------ quantower/Oscillators/CtiIndicator.cs | 14 +--------- quantower/Oscillators/RsiIndicator.cs | 25 +++++------------ quantower/Oscillators/RsxIndicator.cs | 13 +-------- quantower/Statistics/CurvatureIndicator.cs | 25 ++++++----------- quantower/Statistics/EntropyIndicator.cs | 21 ++++----------- quantower/Statistics/KurtosisIndicator.cs | 23 +++++----------- quantower/Statistics/MaxIndicator.cs | 21 ++++----------- quantower/Statistics/MedianIndicator.cs | 23 +++++----------- quantower/Statistics/MinIndicator.cs | 21 ++++----------- quantower/Statistics/ModeIndicator.cs | 23 +++++----------- quantower/Statistics/PercentileIndicator.cs | 21 ++++----------- quantower/Statistics/SkewIndicator.cs | 21 ++++----------- quantower/Statistics/SlopeIndicator.cs | 23 +++++----------- quantower/Statistics/StddevIndicator.cs | 21 ++++----------- quantower/Statistics/VarianceIndicator.cs | 21 ++++----------- quantower/Statistics/ZscoreIndicator.cs | 21 ++++----------- quantower/Volatility/AtrIndicator.cs | 12 ++++----- quantower/Volatility/CmoIndicator.cs | 25 +++++------------ quantower/Volatility/CviIndicator.cs | 12 ++++----- quantower/Volatility/HistoricalIndicator.cs | 10 +++---- quantower/Volatility/JbandsIndicator.cs | 23 +++++----------- quantower/Volatility/JvoltyIndicator.cs | 21 ++++----------- quantower/Volatility/RealizedIndicator.cs | 10 +++---- quantower/Volatility/RviIndicator.cs | 10 +++---- 75 files changed, 370 insertions(+), 1053 deletions(-) diff --git a/quantower/Averages/AfirmaIndicator.cs b/quantower/Averages/AfirmaIndicator.cs index f852b33d..cd4a4319 100644 --- a/quantower/Averages/AfirmaIndicator.cs +++ b/quantower/Averages/AfirmaIndicator.cs @@ -8,8 +8,8 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator [InputParameter("Taps (number of weights)", sortIndex: 1, 1, 2000, 1, 0)] public int Taps { get; set; } = 6; - [InputParameter("Periods for lowpass cutoff", sortIndex: 2, 1, 2000, 1, 0)] - public int Periods { get; set; } = 6; + [InputParameter("Period for lowpass cutoff", sortIndex: 2, 1, 2000, 1, 0)] + public int Period { get; set; } = 6; [InputParameter("Window Type", sortIndex: 3, variants: [ "Rectangular", Afirma.WindowType.Rectangular, @@ -20,18 +20,7 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator ])] public Afirma.WindowType Window { get; set; } = Afirma.WindowType.Hanning1; - [InputParameter("Data source", sortIndex: 4, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -39,7 +28,7 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator private Afirma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods + Taps; + public int MinHistoryDepths => Period + Taps; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public AfirmaIndicator() @@ -50,13 +39,13 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator Name = "AFIRMA - Adaptive Finite Impulse Response Moving Average"; Description = "Adaptive Finite Impulse Response Moving Average with ARMA component"; - Series = new(name: $"AFIRMA {Taps}:{Periods}:{Window}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"AFIRMA {Taps}:{Period}:{Window}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Afirma(periods: Periods, taps: Taps, window: Window); + ma = new Afirma(periods: Period, taps: Taps, window: Window); SourceName = Source.ToString(); base.OnInit(); } @@ -70,7 +59,7 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator Series!.SetValue(result.Value); } - public override string ShortName => $"AFIRMA {Taps}:{Periods}:{Window}:{SourceName}"; + public override string ShortName => $"AFIRMA {Taps}:{Period}:{Window}:{SourceName}"; public override void OnPaintChart(PaintChartEventArgs args) { diff --git a/quantower/Averages/AlmaIndicator.cs b/quantower/Averages/AlmaIndicator.cs index c5112fce..ac1511cb 100644 --- a/quantower/Averages/AlmaIndicator.cs +++ b/quantower/Averages/AlmaIndicator.cs @@ -14,18 +14,7 @@ public class AlmaIndicator : Indicator, IWatchlistIndicator [InputParameter("Sigma", sortIndex: 3, minimum: 0, maximum: 100, decimalPlaces: 1)] public double Sigma { get; set; } = 6.0; - [InputParameter("Data source", sortIndex: 4, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Averages/DemaIndicator.cs b/quantower/Averages/DemaIndicator.cs index 1fa15213..31444149 100644 --- a/quantower/Averages/DemaIndicator.cs +++ b/quantower/Averages/DemaIndicator.cs @@ -8,18 +8,7 @@ public class DemaIndicator : Indicator, IWatchlistIndicator [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] public int Period { get; set; } = 10; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Averages/DsmaIndicator.cs b/quantower/Averages/DsmaIndicator.cs index 02370c74..9a41e31a 100644 --- a/quantower/Averages/DsmaIndicator.cs +++ b/quantower/Averages/DsmaIndicator.cs @@ -11,18 +11,7 @@ public class DsmaIndicator : Indicator, IWatchlistIndicator [InputParameter("Scale factor", sortIndex: 2, minimum: 0.01, maximum: 1.0, increment: 0.01, decimalPlaces: 2)] public double Scale { get; set; } = 0.5; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Averages/DwmaIndicator.cs b/quantower/Averages/DwmaIndicator.cs index 2cb65bc1..ae181e33 100644 --- a/quantower/Averages/DwmaIndicator.cs +++ b/quantower/Averages/DwmaIndicator.cs @@ -8,18 +8,7 @@ public class DwmaIndicator : Indicator, IWatchlistIndicator [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] public int Period { get; set; } = 10; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Averages/EmaIndicator.cs b/quantower/Averages/EmaIndicator.cs index 8c790662..4dbe4784 100644 --- a/quantower/Averages/EmaIndicator.cs +++ b/quantower/Averages/EmaIndicator.cs @@ -5,23 +5,12 @@ namespace QuanTAlib; public class EmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 10; [InputParameter("Use SMA for warmup period", sortIndex: 2)] public bool UseSMA { get; set; } = false; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -30,10 +19,10 @@ public class EmaIndicator : Indicator, IWatchlistIndicator private Ema? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"EMA {Periods}:{SourceName}"; + public override string ShortName => $"EMA {Period}:{SourceName}"; public EmaIndicator() { @@ -42,13 +31,13 @@ public class EmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "EMA - Exponential Moving Average"; Description = "Exponential Moving Average"; - Series = new(name: $"EMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"EMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Ema(Periods, useSma: UseSMA); + ma = new Ema(Period, useSma: UseSMA); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/EpmaIndicator.cs b/quantower/Averages/EpmaIndicator.cs index 45f6af1c..b819414d 100644 --- a/quantower/Averages/EpmaIndicator.cs +++ b/quantower/Averages/EpmaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class EpmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 10; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class EpmaIndicator : Indicator, IWatchlistIndicator private Epma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"EPMA {Periods}:{SourceName}"; + public override string ShortName => $"EPMA {Period}:{SourceName}"; public EpmaIndicator() { @@ -40,13 +29,13 @@ public class EpmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "EPMA - Exponential Percentage Moving Average"; Description = "Exponential Percentage Moving Average"; - Series = new(name: $"EPMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"EPMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Epma(Periods); + ma = new Epma(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/FramaIndicator.cs b/quantower/Averages/FramaIndicator.cs index 8d15d1d9..a5279ddd 100644 --- a/quantower/Averages/FramaIndicator.cs +++ b/quantower/Averages/FramaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class FramaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)] + public int Period { get; set; } = 10; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class FramaIndicator : Indicator, IWatchlistIndicator private Frama? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods * 2; + public int MinHistoryDepths => Period * 2; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"FRAMA {Periods}:{SourceName}"; + public override string ShortName => $"FRAMA {Period}:{SourceName}"; public FramaIndicator() { @@ -40,13 +29,13 @@ public class FramaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "FRAMA - Fractal Adaptive Moving Average"; Description = "Fractal Adaptive Moving Average"; - Series = new(name: $"FRAMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"FRAMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Frama(Periods); + ma = new Frama(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/FwmaIndicator.cs b/quantower/Averages/FwmaIndicator.cs index b59da7b8..545fc648 100644 --- a/quantower/Averages/FwmaIndicator.cs +++ b/quantower/Averages/FwmaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class FwmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 10; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class FwmaIndicator : Indicator, IWatchlistIndicator private Fwma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"FWMA {Periods}:{SourceName}"; + public override string ShortName => $"FWMA {Period}:{SourceName}"; public FwmaIndicator() { @@ -40,13 +29,13 @@ public class FwmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "FWMA - Fibonacci Weighted Moving Average"; Description = "Fibonacci Weighted Moving Average"; - Series = new(name: $"FWMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"FWMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Fwma(Periods); + ma = new Fwma(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/GmaIndicator.cs b/quantower/Averages/GmaIndicator.cs index fa8700a3..4a7e8db1 100644 --- a/quantower/Averages/GmaIndicator.cs +++ b/quantower/Averages/GmaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class GmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 10; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class GmaIndicator : Indicator, IWatchlistIndicator private Gma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"GMA {Periods}:{SourceName}"; + public override string ShortName => $"GMA {Period}:{SourceName}"; public GmaIndicator() { @@ -40,13 +29,13 @@ public class GmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "GMA - Gaussian Moving Average"; Description = "Gaussian Moving Average"; - Series = new(name: $"GMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"GMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Gma(Periods); + ma = new Gma(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/HmaIndicator.cs b/quantower/Averages/HmaIndicator.cs index ec903a34..65fabc67 100644 --- a/quantower/Averages/HmaIndicator.cs +++ b/quantower/Averages/HmaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class HmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)] + public int Period { get; set; } = 10; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class HmaIndicator : Indicator, IWatchlistIndicator private Hma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods + (int)Math.Sqrt(Periods) - 1; + public int MinHistoryDepths => Period + (int)Math.Sqrt(Period) - 1; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"HMA {Periods}:{SourceName}"; + public override string ShortName => $"HMA {Period}:{SourceName}"; public HmaIndicator() { @@ -40,13 +29,13 @@ public class HmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "HMA - Hull Moving Average"; Description = "Hull Moving Average"; - Series = new(name: $"HMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"HMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Hma(Periods); + ma = new Hma(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/HtitIndicator.cs b/quantower/Averages/HtitIndicator.cs index f8831085..4c25a5e2 100644 --- a/quantower/Averages/HtitIndicator.cs +++ b/quantower/Averages/HtitIndicator.cs @@ -5,18 +5,7 @@ namespace QuanTAlib; public class HtitIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Data source", sortIndex: 1, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Averages/HwmaIndicator.cs b/quantower/Averages/HwmaIndicator.cs index b92072aa..050be88c 100644 --- a/quantower/Averages/HwmaIndicator.cs +++ b/quantower/Averages/HwmaIndicator.cs @@ -5,8 +5,8 @@ namespace QuanTAlib; public class HwmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods (only when nA=nB=nC=0)", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period (only when nA=nB=nC=0)", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 10; [InputParameter("nA", sortIndex: 2, 0, 1, 0.01, 2)] public double NA { get; set; } = 0; @@ -17,18 +17,7 @@ public class HwmaIndicator : Indicator, IWatchlistIndicator [InputParameter("nC", sortIndex: 4, 0, 1, 0.01, 2)] public double NC { get; set; } = 0; - [InputParameter("Data source", sortIndex: 5, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -37,10 +26,10 @@ public class HwmaIndicator : Indicator, IWatchlistIndicator private Hwma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"HWMA {Periods}:{NA}:{NB}:{NC}:{SourceName}"; + public override string ShortName => $"HWMA {Period}:{NA}:{NB}:{NC}:{SourceName}"; public HwmaIndicator() { @@ -49,7 +38,7 @@ public class HwmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "HWMA - Holt-Winter Moving Average"; Description = "Holt-Winter Moving Average"; - Series = new(name: $"HWMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"HWMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } @@ -57,11 +46,11 @@ public class HwmaIndicator : Indicator, IWatchlistIndicator { if ((NA, NB, NC) == (0, 0, 0)) { - ma = new Hwma(Periods); + ma = new Hwma(Period); } else { - ma = new Hwma(Periods, NA, NB, NC); + ma = new Hwma(Period, NA, NB, NC); } SourceName = Source.ToString(); base.OnInit(); diff --git a/quantower/Averages/JmaIndicator.cs b/quantower/Averages/JmaIndicator.cs index 7eaca362..a6ce3d0b 100644 --- a/quantower/Averages/JmaIndicator.cs +++ b/quantower/Averages/JmaIndicator.cs @@ -5,8 +5,8 @@ namespace QuanTAlib; public class JmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 10; [InputParameter("Phase", sortIndex: 2, -100, 100, 1, 0)] public int Phase { get; set; } = 0; @@ -14,18 +14,7 @@ public class JmaIndicator : Indicator, IWatchlistIndicator [InputParameter("Beta factor", sortIndex: 3, minimum: 0, maximum: 5, increment: 0.01, decimalPlaces: 2)] public double Factor { get; set; } = 0.45; - [InputParameter("Data source", sortIndex: 4, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -34,10 +23,10 @@ public class JmaIndicator : Indicator, IWatchlistIndicator private Jma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Math.Max(65, Periods * 2); + public int MinHistoryDepths => Math.Max(65, Period * 2); int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"JMA {Periods}:{Phase}:{Factor:F2}:{SourceName}"; + public override string ShortName => $"JMA {Period}:{Phase}:{Factor:F2}:{SourceName}"; public JmaIndicator() { @@ -46,13 +35,13 @@ public class JmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "JMA - Jurik Moving Average"; Description = "Jurik Moving Average (Note: This indicator may have consistency issues)"; - Series = new(name: $"JMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"JMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Jma(period: Periods, phase: Phase, factor: Factor); + ma = new Jma(period: Period, phase: Phase, factor: Factor); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/KamaIndicator.cs b/quantower/Averages/KamaIndicator.cs index c7456879..62fe4e0e 100644 --- a/quantower/Averages/KamaIndicator.cs +++ b/quantower/Averages/KamaIndicator.cs @@ -5,8 +5,8 @@ namespace QuanTAlib; public class KamaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 10; [InputParameter("Fast", sortIndex: 2, 1, 100, 1, 0)] public int Fast { get; set; } = 2; @@ -14,18 +14,7 @@ public class KamaIndicator : Indicator, IWatchlistIndicator [InputParameter("Slow", sortIndex: 3, 1, 100, 1, 0)] public int Slow { get; set; } = 30; - [InputParameter("Data source", sortIndex: 4, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -34,10 +23,10 @@ public class KamaIndicator : Indicator, IWatchlistIndicator private Kama? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"KAMA {Periods}:{Fast}:{Slow}:{SourceName}"; + public override string ShortName => $"KAMA {Period}:{Fast}:{Slow}:{SourceName}"; public KamaIndicator() { @@ -46,13 +35,13 @@ public class KamaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "KAMA - Kaufman's Adaptive Moving Average"; Description = "Kaufman's Adaptive Moving Average"; - Series = new(name: $"KAMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"KAMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Kama(Periods, Fast, Slow); + ma = new Kama(Period, Fast, Slow); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/LtmaIndicator.cs b/quantower/Averages/LtmaIndicator.cs index 496d5701..7729789e 100644 --- a/quantower/Averages/LtmaIndicator.cs +++ b/quantower/Averages/LtmaIndicator.cs @@ -8,18 +8,7 @@ public class LtmaIndicator : Indicator, IWatchlistIndicator [InputParameter("Gamma", sortIndex: 1, 0.01, 1, 0.01, 2)] public double Gamma { get; set; } = 0.1; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Averages/MaafIndicator.cs b/quantower/Averages/MaafIndicator.cs index 15550e4d..18179e07 100644 --- a/quantower/Averages/MaafIndicator.cs +++ b/quantower/Averages/MaafIndicator.cs @@ -5,24 +5,13 @@ namespace QuanTAlib; public class MaafIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 3, 1000, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period", sortIndex: 1, 3, 1000, 1, 0)] + public int Period { get; set; } = 10; [InputParameter("Threshold", sortIndex: 2, 0.0001, 0.1, 0.0001, 4)] public double Threshold { get; set; } = 0.002; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -31,10 +20,10 @@ public class MaafIndicator : Indicator, IWatchlistIndicator private Maaf? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"MAAF {Periods}:{Threshold}:{SourceName}"; + public override string ShortName => $"MAAF {Period}:{Threshold}:{SourceName}"; public MaafIndicator() { @@ -43,13 +32,13 @@ public class MaafIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "MAAF - Median Adaptive Averaging Filter"; Description = "Median Adaptive Averaging Filter (Note: This indicator may have consistency issues)"; - Series = new(name: $"MAAF {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"MAAF {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Maaf(Periods, Threshold); + ma = new Maaf(Period, Threshold); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/MamaIndicator.cs b/quantower/Averages/MamaIndicator.cs index 870fc2c1..a69ad283 100644 --- a/quantower/Averages/MamaIndicator.cs +++ b/quantower/Averages/MamaIndicator.cs @@ -11,18 +11,7 @@ public class MamaIndicator : Indicator, IWatchlistIndicator [InputParameter("Slow Limit", sortIndex: 2, 0.01, 1, 0.01, 2)] public double SlowLimit { get; set; } = 0.05; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Averages/MgdiIndicator.cs b/quantower/Averages/MgdiIndicator.cs index 77b0b381..7fed5755 100644 --- a/quantower/Averages/MgdiIndicator.cs +++ b/quantower/Averages/MgdiIndicator.cs @@ -5,24 +5,13 @@ namespace QuanTAlib; public class MgdiIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; [InputParameter("K-Factor", sortIndex: 2, 0.1, 2, 0.1, 1)] public double KFactor { get; set; } = 0.6; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -31,10 +20,10 @@ public class MgdiIndicator : Indicator, IWatchlistIndicator private Mgdi? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"MGDI {Periods}:{KFactor}:{SourceName}"; + public override string ShortName => $"MGDI {Period}:{KFactor}:{SourceName}"; public MgdiIndicator() { @@ -43,13 +32,13 @@ public class MgdiIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "MGDI - McGinley Dynamic Indicator"; Description = "McGinley Dynamic Indicator"; - Series = new(name: $"MGDI {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"MGDI {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Mgdi(Periods, KFactor); + ma = new Mgdi(Period, KFactor); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/MmaIndicator.cs b/quantower/Averages/MmaIndicator.cs index 57cc296c..14e00c20 100644 --- a/quantower/Averages/MmaIndicator.cs +++ b/quantower/Averages/MmaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class MmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class MmaIndicator : Indicator, IWatchlistIndicator private Mma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"MMA {Periods}:{SourceName}"; + public override string ShortName => $"MMA {Period}:{SourceName}"; public MmaIndicator() { @@ -40,13 +29,13 @@ public class MmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "MMA - Modified Moving Average"; Description = "Modified Moving Average"; - Series = new(name: $"MMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"MMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Mma(Periods); + ma = new Mma(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/PwmaIndicator.cs b/quantower/Averages/PwmaIndicator.cs index 17d7b667..603ed959 100644 --- a/quantower/Averages/PwmaIndicator.cs +++ b/quantower/Averages/PwmaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class PwmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class PwmaIndicator : Indicator, IWatchlistIndicator private Pwma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"PWMA {Periods}:{SourceName}"; + public override string ShortName => $"PWMA {Period}:{SourceName}"; public PwmaIndicator() { @@ -40,13 +29,13 @@ public class PwmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "PWMA - Pascal's Weighted Moving Average"; Description = "Pascal's Weighted Moving Average"; - Series = new(name: $"PWMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"PWMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Pwma(Periods); + ma = new Pwma(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/RemaIndicator.cs b/quantower/Averages/RemaIndicator.cs index 80a0916b..deeb6aba 100644 --- a/quantower/Averages/RemaIndicator.cs +++ b/quantower/Averages/RemaIndicator.cs @@ -5,24 +5,13 @@ namespace QuanTAlib; public class RemaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; [InputParameter("Lambda", sortIndex: 2, 0, 1, 0.01, 2)] public double Lambda { get; set; } = 0.5; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -31,10 +20,10 @@ public class RemaIndicator : Indicator, IWatchlistIndicator private Rema? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"REMA {Periods}:{Lambda}:{SourceName}"; + public override string ShortName => $"REMA {Period}:{Lambda}:{SourceName}"; public RemaIndicator() { @@ -43,13 +32,13 @@ public class RemaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "REMA - Regularized Exponential Moving Average"; Description = "Regularized Exponential Moving Average"; - Series = new(name: $"REMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"REMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Rema(Periods, Lambda); + ma = new Rema(Period, Lambda); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/RmaIndicator.cs b/quantower/Averages/RmaIndicator.cs index 25270465..c3d0aca5 100644 --- a/quantower/Averages/RmaIndicator.cs +++ b/quantower/Averages/RmaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class RmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class RmaIndicator : Indicator, IWatchlistIndicator private Rma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods * 2; + public int MinHistoryDepths => Period * 2; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"RMA {Periods}:{SourceName}"; + public override string ShortName => $"RMA {Period}:{SourceName}"; public RmaIndicator() { @@ -40,13 +29,13 @@ public class RmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "RMA - Relative Moving Average (Wilder's Moving Average)"; Description = "Relative Moving Average, also known as Wilder's Moving Average"; - Series = new(name: $"RMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"RMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Rma(Periods); + ma = new Rma(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/SinemaIndicator.cs b/quantower/Averages/SinemaIndicator.cs index 8b961acd..1b4ea42e 100644 --- a/quantower/Averages/SinemaIndicator.cs +++ b/quantower/Averages/SinemaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class SinemaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class SinemaIndicator : Indicator, IWatchlistIndicator private Sinema? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"SINEMA {Periods}:{SourceName}"; + public override string ShortName => $"SINEMA {Period}:{SourceName}"; public SinemaIndicator() { @@ -40,13 +29,13 @@ public class SinemaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "SINEMA - Sine-Weighted Moving Average"; Description = "Sine-Weighted Moving Average"; - Series = new(name: $"SINEMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"SINEMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Sinema(Periods); + ma = new Sinema(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/SmaIndicator.cs b/quantower/Averages/SmaIndicator.cs index 31bd9107..b6858d1d 100644 --- a/quantower/Averages/SmaIndicator.cs +++ b/quantower/Averages/SmaIndicator.cs @@ -8,18 +8,7 @@ public class SmaIndicator : Indicator, IWatchlistIndicator [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Averages/SmmaIndicator.cs b/quantower/Averages/SmmaIndicator.cs index b43070a2..79e0184f 100644 --- a/quantower/Averages/SmmaIndicator.cs +++ b/quantower/Averages/SmmaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class SmmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class SmmaIndicator : Indicator, IWatchlistIndicator private Smma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"SMMA {Periods}:{SourceName}"; + public override string ShortName => $"SMMA {Period}:{SourceName}"; public SmmaIndicator() { @@ -40,13 +29,13 @@ public class SmmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "SMMA - Smoothed Moving Average"; Description = "Smoothed Moving Average"; - Series = new(name: $"SMMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"SMMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Smma(Periods); + ma = new Smma(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/T3Indicator.cs b/quantower/Averages/T3Indicator.cs index ccf62cdd..2a9e8b3a 100644 --- a/quantower/Averages/T3Indicator.cs +++ b/quantower/Averages/T3Indicator.cs @@ -5,8 +5,8 @@ namespace QuanTAlib; public class T3Indicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; [InputParameter("Volume Factor", sortIndex: 2, 0, 1, 0.01, 2)] public double VolumeFactor { get; set; } = 0.7; @@ -14,18 +14,7 @@ public class T3Indicator : Indicator, IWatchlistIndicator [InputParameter("Use SMA", sortIndex: 3)] public bool UseSma { get; set; } = true; - [InputParameter("Data source", sortIndex: 4, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -34,10 +23,10 @@ public class T3Indicator : Indicator, IWatchlistIndicator private T3? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"T3 {Periods}:{VolumeFactor}:{UseSma}:{SourceName}"; + public override string ShortName => $"T3 {Period}:{VolumeFactor}:{UseSma}:{SourceName}"; public T3Indicator() { @@ -46,13 +35,13 @@ public class T3Indicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "T3 - Tillson T3 Moving Average"; Description = "Tillson T3 Moving Average"; - Series = new(name: $"T3 {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"T3 {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new T3(Periods, VolumeFactor, UseSma); + ma = new T3(Period, VolumeFactor, UseSma); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/TemaIndicator.cs b/quantower/Averages/TemaIndicator.cs index f37a03c9..60c43616 100644 --- a/quantower/Averages/TemaIndicator.cs +++ b/quantower/Averages/TemaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class TemaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class TemaIndicator : Indicator, IWatchlistIndicator private Tema? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => (int)Math.Ceiling(-Periods * Math.Log(1 - 0.85)); + public int MinHistoryDepths => (int)Math.Ceiling(-Period * Math.Log(1 - 0.85)); int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"TEMA {Periods}:{SourceName}"; + public override string ShortName => $"TEMA {Period}:{SourceName}"; public TemaIndicator() { @@ -40,13 +29,13 @@ public class TemaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "TEMA - Triple Exponential Moving Average"; Description = "Triple Exponential Moving Average"; - Series = new(name: $"TEMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"TEMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Tema(Periods); + ma = new Tema(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/TrimaIndicator.cs b/quantower/Averages/TrimaIndicator.cs index 2350d4e5..7d7f9729 100644 --- a/quantower/Averages/TrimaIndicator.cs +++ b/quantower/Averages/TrimaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class TrimaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class TrimaIndicator : Indicator, IWatchlistIndicator private Trima? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"TRIMA {Periods}:{SourceName}"; + public override string ShortName => $"TRIMA {Period}:{SourceName}"; public TrimaIndicator() { @@ -40,13 +29,13 @@ public class TrimaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "TRIMA - Triangular Moving Average"; Description = "Triangular Moving Average"; - Series = new(name: $"TRIMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"TRIMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Trima(Periods); + ma = new Trima(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/VidyaIndicator.cs b/quantower/Averages/VidyaIndicator.cs index 3b4c395c..813e5efc 100644 --- a/quantower/Averages/VidyaIndicator.cs +++ b/quantower/Averages/VidyaIndicator.cs @@ -13,19 +13,8 @@ public class VidyaIndicator : Indicator, IWatchlistIndicator [InputParameter("Alpha", sortIndex: 3, 0.01, 1, 0.01, 2)] public double Alpha { get; set; } = 0.2; - - [InputParameter("Data source", sortIndex: 4, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Averages/WmaIndicator.cs b/quantower/Averages/WmaIndicator.cs index 0c76128d..502d27de 100644 --- a/quantower/Averages/WmaIndicator.cs +++ b/quantower/Averages/WmaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class WmaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,10 +17,10 @@ public class WmaIndicator : Indicator, IWatchlistIndicator private Wma? ma; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"WMA {Periods}:{SourceName}"; + public override string ShortName => $"WMA {Period}:{SourceName}"; public WmaIndicator() { @@ -40,13 +29,13 @@ public class WmaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "WMA - Weighted Moving Average"; Description = "Weighted Moving Average"; - Series = new(name: $"WMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"WMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new Wma(Periods); + ma = new Wma(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Averages/ZlemaIndicator.cs b/quantower/Averages/ZlemaIndicator.cs index 30bf7200..69268f30 100644 --- a/quantower/Averages/ZlemaIndicator.cs +++ b/quantower/Averages/ZlemaIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class ZlemaIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -29,10 +18,10 @@ public class ZlemaIndicator : Indicator, IWatchlistIndicator private Huber? err; protected LineSeries? Series; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; - public override string ShortName => $"ZLEMA {Periods}:{SourceName}"; + public override string ShortName => $"ZLEMA {Period}:{SourceName}"; public ZlemaIndicator() { @@ -41,14 +30,14 @@ public class ZlemaIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); Name = "ZLEMA - Zero Lag Exponential Moving Average"; Description = "Zero Lag Exponential Moving Average"; - Series = new(name: $"ZLEMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); + Series = new(name: $"ZLEMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid); AddLineSeries(Series); } protected override void OnInit() { - ma = new(Periods); - err = new(Periods); + ma = new(Period); + err = new(Period); SourceName = Source.ToString(); base.OnInit(); } diff --git a/quantower/Experiments/ConvolutionIndicator.cs b/quantower/Experiments/ConvolutionIndicator.cs index f46ad6a4..6fcbb8b6 100644 --- a/quantower/Experiments/ConvolutionIndicator.cs +++ b/quantower/Experiments/ConvolutionIndicator.cs @@ -9,18 +9,7 @@ public class ConvolutionIndicator : Indicator, IWatchlistIndicator [InputParameter("Kernel (comma/space/semicolon separated numbers)", sortIndex: 1)] public string KernelString { get; set; } = "0.25, 0.5, 0.25, -0.5"; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Experiments/QemaIndicator.cs b/quantower/Experiments/QemaIndicator.cs index 1bb65542..6cbf3b27 100644 --- a/quantower/Experiments/QemaIndicator.cs +++ b/quantower/Experiments/QemaIndicator.cs @@ -17,18 +17,7 @@ public class QemaIndicator : Indicator, IWatchlistIndicator [InputParameter("K4", sortIndex: 4, 0.01, 1, 0.01, 2)] public double K4 { get; set; } = 0.2; - [InputParameter("Data source", sortIndex: 5, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Experiments/TestIndicator.cs b/quantower/Experiments/TestIndicator.cs index 37f416d2..cdb101e4 100644 --- a/quantower/Experiments/TestIndicator.cs +++ b/quantower/Experiments/TestIndicator.cs @@ -8,18 +8,7 @@ public class TestIndicator : Indicator, IWatchlistIndicator [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] public int Period { get; set; } = 10; - [InputParameter("Data source", sortIndex: 20, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/IndicatorExtensions.cs b/quantower/IndicatorExtensions.cs index e3a7e369..a9ea433c 100644 --- a/quantower/IndicatorExtensions.cs +++ b/quantower/IndicatorExtensions.cs @@ -24,6 +24,26 @@ public static class IndicatorExtensions public static readonly Color Momentum = Color.FromArgb(128, 255, 255); // #80FFFF - Cyan public static readonly Color Experiments = Color.FromArgb(255, 165, 0); // #FFA500 - Orange + [AttributeUsage(AttributeTargets.Property)] + public class DataSourceInputAttribute : InputParameterAttribute + { + public DataSourceInputAttribute(string label = "Data source", int sortIndex = 20) + : base(label, sortIndex, variants: new object[] + { + "Open", SourceType.Open, + "High", SourceType.High, + "Low", SourceType.Low, + "Close", SourceType.Close, + "HL/2 (Median)", SourceType.HL2, + "OC/2 (Midpoint)", SourceType.OC2, + "OHL/3 (Mean)", SourceType.OHL3, + "HLC/3 (Typical)", SourceType.HLC3, + "OHLC/4 (Average)", SourceType.OHLC4, + "HLCC/4 (Weighted)", SourceType.HLCC4 + }) + { } + } + public static TValue GetInputValue(this Indicator indicator, UpdateArgs args, SourceType source) { var historicalData = indicator.HistoricalData; diff --git a/quantower/Momentum/AdxIndicator.cs b/quantower/Momentum/AdxIndicator.cs index d376d60d..e62e6465 100644 --- a/quantower/Momentum/AdxIndicator.cs +++ b/quantower/Momentum/AdxIndicator.cs @@ -5,15 +5,15 @@ namespace QuanTAlib; public class AdxIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 14; [InputParameter("Show cold values", sortIndex: 21)] public bool ShowColdValues { get; set; } = true; private Adx? adx; protected LineSeries? AdxSeries; - public int MinHistoryDepths => Math.Max(5, Periods * 3); // Need extra periods for ADX calculation + public int MinHistoryDepths => Math.Max(5, Period * 3); // Need extra periods for ADX calculation int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public AdxIndicator() @@ -22,13 +22,13 @@ public class AdxIndicator : Indicator, IWatchlistIndicator Description = "Measures the strength of a trend, regardless of its direction."; SeparateWindow = true; - AdxSeries = new($"ADX {Periods}", color: IndicatorExtensions.Momentum, 2, LineStyle.Solid); + AdxSeries = new($"ADX {Period}", color: IndicatorExtensions.Momentum, 2, LineStyle.Solid); AddLineSeries(AdxSeries); } protected override void OnInit() { - adx = new Adx(Periods); + adx = new Adx(Period); base.OnInit(); } @@ -43,7 +43,7 @@ public class AdxIndicator : Indicator, IWatchlistIndicator #pragma warning disable CA1416 // Validate platform compatibility - public override string ShortName => $"ADX ({Periods})"; + public override string ShortName => $"ADX ({Period})"; public override void OnPaintChart(PaintChartEventArgs args) { diff --git a/quantower/Momentum/AdxrIndicator.cs b/quantower/Momentum/AdxrIndicator.cs index 2a55689a..8e105ea4 100644 --- a/quantower/Momentum/AdxrIndicator.cs +++ b/quantower/Momentum/AdxrIndicator.cs @@ -5,15 +5,15 @@ namespace QuanTAlib; public class AdxrIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 14; [InputParameter("Show cold values", sortIndex: 21)] public bool ShowColdValues { get; set; } = true; private Adxr? adxr; protected LineSeries? AdxrSeries; - public int MinHistoryDepths => Math.Max(5, Periods * 4); // Need extra periods for ADXR calculation + public int MinHistoryDepths => Math.Max(5, Period * 4); // Need extra periods for ADXR calculation int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public AdxrIndicator() @@ -22,13 +22,13 @@ public class AdxrIndicator : Indicator, IWatchlistIndicator Description = "Measures trend strength by comparing current ADX with historical ADX values."; SeparateWindow = true; - AdxrSeries = new($"ADXR {Periods}", Color.Blue, 2, LineStyle.Solid); + AdxrSeries = new($"ADXR {Period}", Color.Blue, 2, LineStyle.Solid); AddLineSeries(AdxrSeries); } protected override void OnInit() { - adxr = new Adxr(Periods); + adxr = new Adxr(Period); base.OnInit(); } @@ -43,7 +43,7 @@ public class AdxrIndicator : Indicator, IWatchlistIndicator #pragma warning disable CA1416 // Validate platform compatibility - public override string ShortName => $"ADXR ({Periods})"; + public override string ShortName => $"ADXR ({Period})"; public override void OnPaintChart(PaintChartEventArgs args) { diff --git a/quantower/Momentum/ApoIndicator.cs b/quantower/Momentum/ApoIndicator.cs index 23748888..df2e977c 100644 --- a/quantower/Momentum/ApoIndicator.cs +++ b/quantower/Momentum/ApoIndicator.cs @@ -11,18 +11,7 @@ public class ApoIndicator : Indicator, IWatchlistIndicator [InputParameter("Slow Period", sortIndex: 2, 1, 2000, 1, 0)] public int SlowPeriod { get; set; } = 26; - [InputParameter("Data source", sortIndex: 4, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; diff --git a/quantower/Momentum/DmiIndicator.cs b/quantower/Momentum/DmiIndicator.cs index 7cd72f7b..c0b5391f 100644 --- a/quantower/Momentum/DmiIndicator.cs +++ b/quantower/Momentum/DmiIndicator.cs @@ -5,8 +5,8 @@ namespace QuanTAlib; public class DmiIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 14; [InputParameter("Show cold values", sortIndex: 21)] public bool ShowColdValues { get; set; } = true; @@ -14,7 +14,7 @@ public class DmiIndicator : Indicator, IWatchlistIndicator private Dmi? dmi; protected LineSeries? PlusDiSeries; protected LineSeries? MinusDiSeries; - public int MinHistoryDepths => Math.Max(5, Periods * 2); + public int MinHistoryDepths => Math.Max(5, Period * 2); int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public DmiIndicator() @@ -23,22 +23,22 @@ public class DmiIndicator : Indicator, IWatchlistIndicator Description = "Identifies the directional movement of a price by comparing successive highs and lows."; SeparateWindow = true; - PlusDiSeries = new($"+DI {Periods}", color: Color.Red, 2, LineStyle.Solid); - MinusDiSeries = new($"-DI {Periods}", color: Color.Blue, 2, LineStyle.Solid); + PlusDiSeries = new($"+DI {Period}", color: Color.Red, 2, LineStyle.Solid); + MinusDiSeries = new($"-DI {Period}", color: Color.Blue, 2, LineStyle.Solid); AddLineSeries(PlusDiSeries); AddLineSeries(MinusDiSeries); } protected override void OnInit() { - dmi = new Dmi(Periods); + dmi = new Dmi(Period); base.OnInit(); } protected override void OnUpdate(UpdateArgs args) { TBar input = IndicatorExtensions.GetInputBar(this, args); - var result = dmi!.Calc(input); + dmi!.Calc(input); PlusDiSeries!.SetValue(dmi.PlusDI); MinusDiSeries!.SetValue(dmi.MinusDI); @@ -48,7 +48,7 @@ public class DmiIndicator : Indicator, IWatchlistIndicator #pragma warning disable CA1416 // Validate platform compatibility - public override string ShortName => $"DMI ({Periods})"; + public override string ShortName => $"DMI ({Period})"; public override void OnPaintChart(PaintChartEventArgs args) { diff --git a/quantower/Momentum/DmxIndicator.cs b/quantower/Momentum/DmxIndicator.cs index fa55606a..68b633a2 100644 --- a/quantower/Momentum/DmxIndicator.cs +++ b/quantower/Momentum/DmxIndicator.cs @@ -5,11 +5,11 @@ namespace QuanTAlib; public class DmxIndicator : Indicator, IWatchlistIndicator { - [InputParameter("DMI Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int DmiPeriods { get; set; } = 14; + [InputParameter("DMI Period", sortIndex: 1, 1, 2000, 1, 0)] + public int DmiPeriod { get; set; } = 14; - [InputParameter("JMA Smoothing Periods", sortIndex: 2, 1, 2000, 1, 0)] - public int JmaPeriods { get; set; } = 12; + [InputParameter("JMA Smoothing Period", sortIndex: 2, 1, 2000, 1, 0)] + public int JmaPeriod { get; set; } = 12; [InputParameter("JMA Phase", sortIndex: 3, -100, 100, 1, 0)] public int JmaPhase { get; set; } = 100; @@ -23,7 +23,7 @@ public class DmxIndicator : Indicator, IWatchlistIndicator private Dmx? dmx; protected LineSeries? PlusDiSeries; protected LineSeries? MinusDiSeries; - public int MinHistoryDepths => Math.Max(5, (DmiPeriods + JmaPeriods) * 2); + public int MinHistoryDepths => Math.Max(5, (DmiPeriod + JmaPeriod) * 2); int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public DmxIndicator() @@ -32,22 +32,22 @@ public class DmxIndicator : Indicator, IWatchlistIndicator Description = "An enhanced version of DMI using JMA smoothing for better noise reduction and responsiveness."; SeparateWindow = true; - PlusDiSeries = new($"+DI {DmiPeriods}", color: Color.Red, 2, LineStyle.Solid); - MinusDiSeries = new($"-DI {DmiPeriods}", color: Color.Blue, 2, LineStyle.Solid); + PlusDiSeries = new($"+DI {DmiPeriod}", color: Color.Red, 2, LineStyle.Solid); + MinusDiSeries = new($"-DI {DmiPeriod}", color: Color.Blue, 2, LineStyle.Solid); AddLineSeries(PlusDiSeries); AddLineSeries(MinusDiSeries); } protected override void OnInit() { - dmx = new Dmx(DmiPeriods, JmaPeriods, JmaPhase, JmaFactor); + dmx = new Dmx(DmiPeriod, JmaPeriod, JmaPhase, JmaFactor); base.OnInit(); } protected override void OnUpdate(UpdateArgs args) { TBar input = IndicatorExtensions.GetInputBar(this, args); - var result = dmx!.Calc(input); + dmx!.Calc(input); PlusDiSeries!.SetValue(dmx.PlusDI); MinusDiSeries!.SetValue(dmx.MinusDI); @@ -57,7 +57,7 @@ public class DmxIndicator : Indicator, IWatchlistIndicator #pragma warning disable CA1416 // Validate platform compatibility - public override string ShortName => $"DMX ({DmiPeriods})"; + public override string ShortName => $"DMX ({DmiPeriod})"; public override void OnPaintChart(PaintChartEventArgs args) { diff --git a/quantower/Momentum/DpoIndicator.cs b/quantower/Momentum/DpoIndicator.cs index 0937956d..0364e7cd 100644 --- a/quantower/Momentum/DpoIndicator.cs +++ b/quantower/Momentum/DpoIndicator.cs @@ -8,18 +8,7 @@ public class DpoIndicator : Indicator, IWatchlistIndicator [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] public int Period { get; set; } = 20; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 3)] diff --git a/quantower/Momentum/MacdIndicator.cs b/quantower/Momentum/MacdIndicator.cs index fd39ce81..71a7e663 100644 --- a/quantower/Momentum/MacdIndicator.cs +++ b/quantower/Momentum/MacdIndicator.cs @@ -19,18 +19,7 @@ public class MacdIndicator : Indicator, IWatchlistIndicator [InputParameter("Use SMA for warmup period", sortIndex: 2)] public bool UseSMA { get; set; } = false; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Momentum/MomIndicator.cs b/quantower/Momentum/MomIndicator.cs index adcf838a..e19fe8f4 100644 --- a/quantower/Momentum/MomIndicator.cs +++ b/quantower/Momentum/MomIndicator.cs @@ -8,18 +8,7 @@ public class MomIndicator : Indicator [InputParameter("Period", sortIndex: 1, minimum: 1, maximum: 2000, increment: 1)] public int Period { get; set; } = 10; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Momentum/PmoIndicator.cs b/quantower/Momentum/PmoIndicator.cs index 1de142e6..d8a3e873 100644 --- a/quantower/Momentum/PmoIndicator.cs +++ b/quantower/Momentum/PmoIndicator.cs @@ -11,18 +11,7 @@ public class PmoIndicator : Indicator [InputParameter("Second Period", sortIndex: 2, minimum: 1, maximum: 2000, increment: 1)] public int Period2 { get; set; } = 20; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Momentum/PoIndicator.cs b/quantower/Momentum/PoIndicator.cs index f6ab642c..06e2fe03 100644 --- a/quantower/Momentum/PoIndicator.cs +++ b/quantower/Momentum/PoIndicator.cs @@ -11,18 +11,7 @@ public class PoIndicator : Indicator [InputParameter("Slow Period", sortIndex: 2, minimum: 1, maximum: 2000, increment: 1)] public int SlowPeriod { get; set; } = 21; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Momentum/PpoIndicator.cs b/quantower/Momentum/PpoIndicator.cs index 5ffe39e1..64b6887b 100644 --- a/quantower/Momentum/PpoIndicator.cs +++ b/quantower/Momentum/PpoIndicator.cs @@ -11,18 +11,7 @@ public class PpoIndicator : Indicator [InputParameter("Slow Period", sortIndex: 2, minimum: 1, maximum: 2000, increment: 1)] public int SlowPeriod { get; set; } = 26; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Momentum/RocIndicator.cs b/quantower/Momentum/RocIndicator.cs index 77ef27b8..52bde17e 100644 --- a/quantower/Momentum/RocIndicator.cs +++ b/quantower/Momentum/RocIndicator.cs @@ -8,18 +8,7 @@ public class RocIndicator : Indicator, IWatchlistIndicator [InputParameter("Period", sortIndex: 1, minimum: 1, maximum: 2000, increment: 1)] public int Period { get; set; } = 12; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Momentum/TrixIndicator.cs b/quantower/Momentum/TrixIndicator.cs index eae53f32..e388e2f9 100644 --- a/quantower/Momentum/TrixIndicator.cs +++ b/quantower/Momentum/TrixIndicator.cs @@ -8,18 +8,7 @@ public class TrixIndicator : Indicator [InputParameter("Period", sortIndex: 1, minimum: 1, maximum: 2000, increment: 1)] public int Period { get; set; } = 18; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Momentum/VelIndicator.cs b/quantower/Momentum/VelIndicator.cs index 67b2df2e..2f7184c2 100644 --- a/quantower/Momentum/VelIndicator.cs +++ b/quantower/Momentum/VelIndicator.cs @@ -14,18 +14,7 @@ public class VelIndicator : Indicator, IWatchlistIndicator [InputParameter("Factor", sortIndex: 3, minimum: 0.1, maximum: 0.9, increment: 0.1, decimalPlaces: 2)] public double Factor { get; set; } = 0.25; - [InputParameter("Data source", sortIndex: 4, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Momentum/VortexIndicator.cs b/quantower/Momentum/VortexIndicator.cs index 78853f69..1fbc66d6 100644 --- a/quantower/Momentum/VortexIndicator.cs +++ b/quantower/Momentum/VortexIndicator.cs @@ -5,8 +5,8 @@ namespace QuanTAlib; public class VortexIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 14; [InputParameter("Show cold values", sortIndex: 21)] public bool ShowColdValues { get; set; } = true; @@ -16,7 +16,7 @@ public class VortexIndicator : Indicator, IWatchlistIndicator protected LineSeries? PlusLine; protected LineSeries? MinusLine; protected LineSeries? ZeroLine; - public int MinHistoryDepths => Math.Max(5, Periods * 2); + public int MinHistoryDepths => Math.Max(5, Period * 2); int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public VortexIndicator() @@ -25,9 +25,9 @@ public class VortexIndicator : Indicator, IWatchlistIndicator Description = "A technical indicator consisting of two oscillating lines that identify trend reversals"; SeparateWindow = true; - ValueSeries = new($"VORTEX({Periods})", color: IndicatorExtensions.Momentum, 2, LineStyle.Solid); - PlusLine = new($"VI+({Periods})", color: Color.Green, 2, LineStyle.Solid); - MinusLine = new($"VI-({Periods})", color: Color.Red, 2, LineStyle.Solid); + ValueSeries = new($"VORTEX({Period})", color: IndicatorExtensions.Momentum, 2, LineStyle.Solid); + PlusLine = new($"VI+({Period})", color: Color.Green, 2, LineStyle.Solid); + MinusLine = new($"VI-({Period})", color: Color.Red, 2, LineStyle.Solid); ZeroLine = new("Zero", Color.Gray, 1, LineStyle.Dot); AddLineSeries(ValueSeries); @@ -38,7 +38,7 @@ public class VortexIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - vortex = new Vortex(Periods); + vortex = new Vortex(Period); base.OnInit(); } @@ -59,7 +59,7 @@ public class VortexIndicator : Indicator, IWatchlistIndicator #pragma warning disable CA1416 // Validate platform compatibility - public override string ShortName => $"VORTEX({Periods})"; + public override string ShortName => $"VORTEX({Period})"; public override void OnPaintChart(PaintChartEventArgs args) { diff --git a/quantower/Oscillators/CtiIndicator.cs b/quantower/Oscillators/CtiIndicator.cs index 51cdb57b..12b65821 100644 --- a/quantower/Oscillators/CtiIndicator.cs +++ b/quantower/Oscillators/CtiIndicator.cs @@ -8,19 +8,7 @@ namespace QuanTAlib [InputParameter("Period", 0, 1, 100, 1, 0)] public int Period { get; set; } = 20; - [InputParameter("Source Type", 1, variants: new object[] - { - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL2", SourceType.HL2, - "OC2", SourceType.OC2, - "OHL3", SourceType.OHL3, - "HLC3", SourceType.HLC3, - "OHLC4", SourceType.OHLC4, - "HLCC4", SourceType.HLCC4 - })] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show Cold Values", 2)] diff --git a/quantower/Oscillators/RsiIndicator.cs b/quantower/Oscillators/RsiIndicator.cs index 0f4fd41d..d4fc25a9 100644 --- a/quantower/Oscillators/RsiIndicator.cs +++ b/quantower/Oscillators/RsiIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class RsiIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 5, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,7 +17,7 @@ public class RsiIndicator : Indicator, IWatchlistIndicator private Rsi? rsi; protected string? SourceName; protected LineSeries? RsiSeries; - public int MinHistoryDepths => Periods + 1; + public int MinHistoryDepths => Period + 1; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public RsiIndicator() @@ -37,13 +26,13 @@ public class RsiIndicator : Indicator, IWatchlistIndicator Description = "Measures the speed and magnitude of recent price changes to evaluate overbought or oversold conditions."; SeparateWindow = true; SourceName = Source.ToString(); - RsiSeries = new($"RSI {Periods}", color: IndicatorExtensions.Oscillators, 2, LineStyle.Solid); + RsiSeries = new($"RSI {Period}", color: IndicatorExtensions.Oscillators, 2, LineStyle.Solid); AddLineSeries(RsiSeries); } protected override void OnInit() { - rsi = new Rsi(Periods); + rsi = new Rsi(Period); base.OnInit(); } @@ -56,7 +45,7 @@ public class RsiIndicator : Indicator, IWatchlistIndicator RsiSeries!.SetMarker(0, Color.Transparent); } - public override string ShortName => $"RSI ({Periods}:{SourceName})"; + public override string ShortName => $"RSI ({Period}:{SourceName})"; #pragma warning disable CA1416 // Validate platform compatibility public override void OnPaintChart(PaintChartEventArgs args) diff --git a/quantower/Oscillators/RsxIndicator.cs b/quantower/Oscillators/RsxIndicator.cs index 16fb8d43..ec9c13d4 100644 --- a/quantower/Oscillators/RsxIndicator.cs +++ b/quantower/Oscillators/RsxIndicator.cs @@ -8,18 +8,7 @@ public class RsxIndicator : Indicator, IWatchlistIndicator [InputParameter("Rsi Period", sortIndex: 1, 1, 2000, 1, 0)] public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 5, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] diff --git a/quantower/Statistics/CurvatureIndicator.cs b/quantower/Statistics/CurvatureIndicator.cs index 7bade979..91c2372a 100644 --- a/quantower/Statistics/CurvatureIndicator.cs +++ b/quantower/Statistics/CurvatureIndicator.cs @@ -5,28 +5,17 @@ namespace QuanTAlib; public class CurvatureIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 3, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 3, 1000, 1, 0)] + public int Period { get; set; } = 20; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Curvature? curvature; protected LineSeries? CurvatureSeries; protected LineSeries? LineSeries; protected string? SourceName; - public int MinHistoryDepths => (Periods * 2) - 1; + public int MinHistoryDepths => (Period * 2) - 1; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public CurvatureIndicator() @@ -37,12 +26,14 @@ public class CurvatureIndicator : Indicator, IWatchlistIndicator SourceName = Source.ToString(); CurvatureSeries = new("Curvature", color: IndicatorExtensions.Statistics, 2, LineStyle.Solid); + LineSeries = new("Line", color: Color.Red, 1, LineStyle.Solid); AddLineSeries(CurvatureSeries); + AddLineSeries(LineSeries); } protected override void OnInit() { - curvature = new Curvature(Periods); + curvature = new Curvature(Period); SourceName = Source.ToString(); base.OnInit(); } @@ -59,5 +50,5 @@ public class CurvatureIndicator : Indicator, IWatchlistIndicator } } - public override string ShortName => $"Curvature ({Periods}:{SourceName})"; + public override string ShortName => $"Curvature ({Period}:{SourceName})"; } diff --git a/quantower/Statistics/EntropyIndicator.cs b/quantower/Statistics/EntropyIndicator.cs index cea46fa5..fb0ba285 100644 --- a/quantower/Statistics/EntropyIndicator.cs +++ b/quantower/Statistics/EntropyIndicator.cs @@ -4,21 +4,10 @@ namespace QuanTAlib; public class EntropyIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)] + public int Period { get; set; } = 20; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Entropy? entropy; @@ -40,7 +29,7 @@ public class EntropyIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - entropy = new Entropy(Periods); + entropy = new Entropy(Period); SourceName = Source.ToString(); base.OnInit(); } @@ -53,5 +42,5 @@ public class EntropyIndicator : Indicator, IWatchlistIndicator EntropySeries!.SetValue(result.Value); } - public override string ShortName => $"Entropy ({Periods}:{SourceName})"; + public override string ShortName => $"Entropy ({Period}:{SourceName})"; } diff --git a/quantower/Statistics/KurtosisIndicator.cs b/quantower/Statistics/KurtosisIndicator.cs index 4e8a0e3d..a4a0a465 100644 --- a/quantower/Statistics/KurtosisIndicator.cs +++ b/quantower/Statistics/KurtosisIndicator.cs @@ -5,27 +5,16 @@ namespace QuanTAlib; public class KurtosisIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 4, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 4, 1000, 1, 0)] + public int Period { get; set; } = 20; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Kurtosis? kurtosis; protected LineSeries? KurtosisSeries; protected string? SourceName; - public int MinHistoryDepths => Periods - 1; + public int MinHistoryDepths => Period - 1; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public KurtosisIndicator() @@ -41,7 +30,7 @@ public class KurtosisIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - kurtosis = new Kurtosis(Periods); + kurtosis = new Kurtosis(Period); SourceName = Source.ToString(); base.OnInit(); } @@ -54,5 +43,5 @@ public class KurtosisIndicator : Indicator, IWatchlistIndicator KurtosisSeries!.SetValue(result.Value); } - public override string ShortName => $"Kurtosis ({Periods}:{SourceName})"; + public override string ShortName => $"Kurtosis ({Period}:{SourceName})"; } diff --git a/quantower/Statistics/MaxIndicator.cs b/quantower/Statistics/MaxIndicator.cs index ee5edb0f..a5bfd135 100644 --- a/quantower/Statistics/MaxIndicator.cs +++ b/quantower/Statistics/MaxIndicator.cs @@ -5,24 +5,13 @@ namespace QuanTAlib; public class MaxIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 20; [InputParameter("Decay", sortIndex: 2, 0, 10, 0.01, 2)] public double Decay { get; set; } = 0; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.High; private Max? ma; @@ -44,7 +33,7 @@ public class MaxIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - ma = new Max(Periods, Decay); + ma = new Max(Period, Decay); SourceName = Source.ToString(); base.OnInit(); } @@ -57,5 +46,5 @@ public class MaxIndicator : Indicator, IWatchlistIndicator MaxSeries!.SetValue(result.Value); } - public override string ShortName => $"Max ({Periods}, {Decay:F2}:{SourceName})"; + public override string ShortName => $"Max ({Period}, {Decay:F2}:{SourceName})"; } diff --git a/quantower/Statistics/MedianIndicator.cs b/quantower/Statistics/MedianIndicator.cs index c2195066..ba4ec4ac 100644 --- a/quantower/Statistics/MedianIndicator.cs +++ b/quantower/Statistics/MedianIndicator.cs @@ -5,27 +5,16 @@ namespace QuanTAlib; public class MedianIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 20; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Median? med; protected LineSeries? MedianSeries; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public MedianIndicator() @@ -41,7 +30,7 @@ public class MedianIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - med = new Median(Periods); + med = new Median(Period); SourceName = Source.ToString(); base.OnInit(); } @@ -54,5 +43,5 @@ public class MedianIndicator : Indicator, IWatchlistIndicator MedianSeries!.SetValue(result.Value); } - public override string ShortName => $"Median ({Periods}:{SourceName})"; + public override string ShortName => $"Median ({Period}:{SourceName})"; } diff --git a/quantower/Statistics/MinIndicator.cs b/quantower/Statistics/MinIndicator.cs index e7545a57..0ca9b38c 100644 --- a/quantower/Statistics/MinIndicator.cs +++ b/quantower/Statistics/MinIndicator.cs @@ -5,24 +5,13 @@ namespace QuanTAlib; public class MinIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 20; [InputParameter("Decay", sortIndex: 2, 0, 10, 0.01, 2)] public double Decay { get; set; } = 0; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Low; private Min? mi; @@ -44,7 +33,7 @@ public class MinIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - mi = new Min(Periods, Decay); + mi = new Min(Period, Decay); SourceName = Source.ToString(); base.OnInit(); } @@ -57,5 +46,5 @@ public class MinIndicator : Indicator, IWatchlistIndicator MinSeries!.SetValue(result.Value); } - public override string ShortName => $"Min ({Periods}, {Decay:F2}:{SourceName})"; + public override string ShortName => $"Min ({Period}, {Decay:F2}:{SourceName})"; } diff --git a/quantower/Statistics/ModeIndicator.cs b/quantower/Statistics/ModeIndicator.cs index 2df23e93..7e6cdfd7 100644 --- a/quantower/Statistics/ModeIndicator.cs +++ b/quantower/Statistics/ModeIndicator.cs @@ -5,27 +5,16 @@ namespace QuanTAlib; public class ModeIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] + public int Period { get; set; } = 20; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Mode? mode; protected LineSeries? ModeSeries; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public ModeIndicator() @@ -41,7 +30,7 @@ public class ModeIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - mode = new Mode(Periods); + mode = new Mode(Period); SourceName = Source.ToString(); base.OnInit(); } @@ -54,5 +43,5 @@ public class ModeIndicator : Indicator, IWatchlistIndicator ModeSeries!.SetValue(result.Value); } - public override string ShortName => $"Mode ({Periods}:{SourceName})"; + public override string ShortName => $"Mode ({Period}:{SourceName})"; } diff --git a/quantower/Statistics/PercentileIndicator.cs b/quantower/Statistics/PercentileIndicator.cs index 96c1cf65..25e93306 100644 --- a/quantower/Statistics/PercentileIndicator.cs +++ b/quantower/Statistics/PercentileIndicator.cs @@ -5,24 +5,13 @@ namespace QuanTAlib; public class PercentileIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)] + public int Period { get; set; } = 20; [InputParameter("Percentile", sortIndex: 2, 0, 100, 0.1, 1)] public double PercentileValue { get; set; } = 50; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Percentile? percentile; @@ -44,7 +33,7 @@ public class PercentileIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - percentile = new Percentile(Periods, PercentileValue); + percentile = new Percentile(Period, PercentileValue); SourceName = Source.ToString(); base.OnInit(); } @@ -57,5 +46,5 @@ public class PercentileIndicator : Indicator, IWatchlistIndicator PercentileSeries!.SetValue(result.Value); } - public override string ShortName => $"Percentile ({Periods}, {PercentileValue}%:{SourceName})"; + public override string ShortName => $"Percentile ({Period}, {PercentileValue}%:{SourceName})"; } diff --git a/quantower/Statistics/SkewIndicator.cs b/quantower/Statistics/SkewIndicator.cs index decd7444..6bafef72 100644 --- a/quantower/Statistics/SkewIndicator.cs +++ b/quantower/Statistics/SkewIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class SkewIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 3, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 3, 1000, 1, 0)] + public int Period { get; set; } = 20; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Skew? skew; @@ -41,7 +30,7 @@ public class SkewIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - skew = new Skew(Periods); + skew = new Skew(Period); SourceName = Source.ToString(); base.OnInit(); } @@ -54,5 +43,5 @@ public class SkewIndicator : Indicator, IWatchlistIndicator SkewSeries!.SetValue(result.Value); } - public override string ShortName => $"Skew ({Periods}:{SourceName})"; + public override string ShortName => $"Skew ({Period}:{SourceName})"; } diff --git a/quantower/Statistics/SlopeIndicator.cs b/quantower/Statistics/SlopeIndicator.cs index e5534d7c..319b3e78 100644 --- a/quantower/Statistics/SlopeIndicator.cs +++ b/quantower/Statistics/SlopeIndicator.cs @@ -5,28 +5,17 @@ namespace QuanTAlib; public class SlopeIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)] + public int Period { get; set; } = 20; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Slope? slope; protected LineSeries? SlopeSeries; protected LineSeries? LineSeries; protected string? SourceName; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public SlopeIndicator() @@ -44,7 +33,7 @@ public class SlopeIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - slope = new Slope(Periods); + slope = new Slope(Period); SourceName = Source.ToString(); base.OnInit(); } @@ -65,7 +54,7 @@ public class SlopeIndicator : Indicator, IWatchlistIndicator { get { - var result = $"Slope ({Periods}:{SourceName})"; + var result = $"Slope ({Period}:{SourceName})"; if (slope != null) { result += $" Slope: {Math.Round(SlopeSeries!.GetValue(), 6)}"; diff --git a/quantower/Statistics/StddevIndicator.cs b/quantower/Statistics/StddevIndicator.cs index 02d5f57a..b269fc75 100644 --- a/quantower/Statistics/StddevIndicator.cs +++ b/quantower/Statistics/StddevIndicator.cs @@ -5,24 +5,13 @@ namespace QuanTAlib; public class StddevIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)] + public int Period { get; set; } = 20; [InputParameter("Population", sortIndex: 2)] public bool IsPopulation { get; set; } = false; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Stddev? stddev; @@ -44,7 +33,7 @@ public class StddevIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - stddev = new Stddev(Periods, IsPopulation); + stddev = new Stddev(Period, IsPopulation); SourceName = Source.ToString(); base.OnInit(); } @@ -57,5 +46,5 @@ public class StddevIndicator : Indicator, IWatchlistIndicator StddevSeries!.SetValue(result.Value); } - public override string ShortName => $"StdDev ({Periods}, {(IsPopulation ? "Pop" : "Sample")}:{SourceName})"; + public override string ShortName => $"StdDev ({Period}, {(IsPopulation ? "Pop" : "Sample")}:{SourceName})"; } diff --git a/quantower/Statistics/VarianceIndicator.cs b/quantower/Statistics/VarianceIndicator.cs index 5f3511f9..f6fdc8f5 100644 --- a/quantower/Statistics/VarianceIndicator.cs +++ b/quantower/Statistics/VarianceIndicator.cs @@ -5,24 +5,13 @@ namespace QuanTAlib; public class VarianceIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)] + public int Period { get; set; } = 20; [InputParameter("Population", sortIndex: 2)] public bool IsPopulation { get; set; } = false; - [InputParameter("Data source", sortIndex: 3, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Variance? variance; @@ -44,7 +33,7 @@ public class VarianceIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - variance = new Variance(Periods, IsPopulation); + variance = new Variance(Period, IsPopulation); SourceName = Source.ToString(); base.OnInit(); } @@ -57,5 +46,5 @@ public class VarianceIndicator : Indicator, IWatchlistIndicator VarianceSeries!.SetValue(result.Value); } - public override string ShortName => $"Variance ({Periods}, {(IsPopulation ? "Pop" : "Sample")}:{SourceName})"; + public override string ShortName => $"Variance ({Period}, {(IsPopulation ? "Pop" : "Sample")}:{SourceName})"; } diff --git a/quantower/Statistics/ZscoreIndicator.cs b/quantower/Statistics/ZscoreIndicator.cs index ba70a8a5..189f8f43 100644 --- a/quantower/Statistics/ZscoreIndicator.cs +++ b/quantower/Statistics/ZscoreIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class ZscoreIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 2, 2000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 2, 2000, 1, 0)] + public int Period { get; set; } = 20; - [InputParameter("Data source", sortIndex: 2, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Zscore? zScore; @@ -41,7 +30,7 @@ public class ZscoreIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - zScore = new Zscore(Periods); + zScore = new Zscore(Period); SourceName = Source.ToString(); base.OnInit(); } @@ -54,5 +43,5 @@ public class ZscoreIndicator : Indicator, IWatchlistIndicator ZscoreSeries!.SetValue(result.Value); } - public override string ShortName => $"Z-Score ({Periods}:{SourceName})"; + public override string ShortName => $"Z-Score ({Period}:{SourceName})"; } diff --git a/quantower/Volatility/AtrIndicator.cs b/quantower/Volatility/AtrIndicator.cs index 0999533a..c919503b 100644 --- a/quantower/Volatility/AtrIndicator.cs +++ b/quantower/Volatility/AtrIndicator.cs @@ -5,15 +5,15 @@ namespace QuanTAlib; public class AtrIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 20; [InputParameter("Show cold values", sortIndex: 21)] public bool ShowColdValues { get; set; } = true; private Atr? atr; protected LineSeries? AtrSeries; - public int MinHistoryDepths => Math.Max(5, Periods * 2); + public int MinHistoryDepths => Math.Max(5, Period * 2); int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public AtrIndicator() @@ -22,13 +22,13 @@ public class AtrIndicator : Indicator, IWatchlistIndicator Description = "Measures market volatility by calculating the average range between high and low prices."; SeparateWindow = true; - AtrSeries = new($"ATR {Periods}", Color.Blue, 2, LineStyle.Solid); + AtrSeries = new($"ATR {Period}", Color.Blue, 2, LineStyle.Solid); AddLineSeries(AtrSeries); } protected override void OnInit() { - atr = new Atr(Periods); + atr = new Atr(Period); base.OnInit(); } @@ -42,7 +42,7 @@ public class AtrIndicator : Indicator, IWatchlistIndicator } #pragma warning disable CA1416 // Validate platform compatibility - public override string ShortName => $"ATR ({Periods})"; + public override string ShortName => $"ATR ({Period})"; public override void OnPaintChart(PaintChartEventArgs args) { diff --git a/quantower/Volatility/CmoIndicator.cs b/quantower/Volatility/CmoIndicator.cs index a507d652..9bfb6d69 100644 --- a/quantower/Volatility/CmoIndicator.cs +++ b/quantower/Volatility/CmoIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class CmoIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 9; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 9; - [InputParameter("Data source", sortIndex: 5, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("Show cold values", sortIndex: 21)] @@ -28,7 +17,7 @@ public class CmoIndicator : Indicator, IWatchlistIndicator private Cmo? cmo; protected string? SourceName; protected LineSeries? CmoSeries; - public int MinHistoryDepths => Periods + 1; + public int MinHistoryDepths => Period + 1; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; @@ -38,13 +27,13 @@ public class CmoIndicator : Indicator, IWatchlistIndicator Description = "Measures the momentum of price changes using the difference between the sum of recent gains and the sum of recent losses."; SeparateWindow = true; SourceName = Source.ToString(); - CmoSeries = new($"CMO {Periods}", color: IndicatorExtensions.Volatility, 2, LineStyle.Solid); + CmoSeries = new($"CMO {Period}", color: IndicatorExtensions.Volatility, 2, LineStyle.Solid); AddLineSeries(CmoSeries); } protected override void OnInit() { - cmo = new Cmo(Periods); + cmo = new Cmo(Period); base.OnInit(); } @@ -57,7 +46,7 @@ public class CmoIndicator : Indicator, IWatchlistIndicator CmoSeries!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here } - public override string ShortName => $"CMO ({Periods}:{SourceName})"; + public override string ShortName => $"CMO ({Period}:{SourceName})"; #pragma warning disable CA1416 // Validate platform compatibility public override void OnPaintChart(PaintChartEventArgs args) diff --git a/quantower/Volatility/CviIndicator.cs b/quantower/Volatility/CviIndicator.cs index be14de29..9df92573 100644 --- a/quantower/Volatility/CviIndicator.cs +++ b/quantower/Volatility/CviIndicator.cs @@ -5,15 +5,15 @@ namespace QuanTAlib; public class CviIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 20; [InputParameter("Show cold values", sortIndex: 21)] public bool ShowColdValues { get; set; } = true; private Cvi? cvi; protected LineSeries? CviSeries; - public int MinHistoryDepths => Math.Max(5, Periods * 2); + public int MinHistoryDepths => Math.Max(5, Period * 2); int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public CviIndicator() @@ -22,13 +22,13 @@ public class CviIndicator : Indicator, IWatchlistIndicator Description = "Measures the volatility of a financial instrument by comparing the spread between the high and low prices."; SeparateWindow = true; - CviSeries = new($"CVI {Periods}", color: IndicatorExtensions.Volatility, 2, LineStyle.Solid); + CviSeries = new($"CVI {Period}", color: IndicatorExtensions.Volatility, 2, LineStyle.Solid); AddLineSeries(CviSeries); } protected override void OnInit() { - cvi = new Cvi(Periods); + cvi = new Cvi(Period); base.OnInit(); } @@ -43,7 +43,7 @@ public class CviIndicator : Indicator, IWatchlistIndicator #pragma warning disable CA1416 // Validate platform compatibility - public override string ShortName => $"CVI ({Periods})"; + public override string ShortName => $"CVI ({Period})"; public override void OnPaintChart(PaintChartEventArgs args) { diff --git a/quantower/Volatility/HistoricalIndicator.cs b/quantower/Volatility/HistoricalIndicator.cs index 9637679f..85b157a7 100644 --- a/quantower/Volatility/HistoricalIndicator.cs +++ b/quantower/Volatility/HistoricalIndicator.cs @@ -5,15 +5,15 @@ namespace QuanTAlib; public class HistoricalIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 20; [InputParameter("Annualized", sortIndex: 2)] public bool IsAnnualized { get; set; } = true; private Hv? historical; protected LineSeries? HvSeries; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public HistoricalIndicator() @@ -28,7 +28,7 @@ public class HistoricalIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - historical = new(Periods, IsAnnualized); + historical = new(Period, IsAnnualized); base.OnInit(); } @@ -40,5 +40,5 @@ public class HistoricalIndicator : Indicator, IWatchlistIndicator HvSeries!.SetValue(result.Value); } - public override string ShortName => $"HV ({Periods}{(IsAnnualized ? " - Annualized" : "")})"; + public override string ShortName => $"HV ({Period}{(IsAnnualized ? " - Annualized" : "")})"; } diff --git a/quantower/Volatility/JbandsIndicator.cs b/quantower/Volatility/JbandsIndicator.cs index e977bb63..2129cfc8 100644 --- a/quantower/Volatility/JbandsIndicator.cs +++ b/quantower/Volatility/JbandsIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class JbandsIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 5, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; [InputParameter("vShort", sortIndex: 6, -100, 100, 1, 0)] @@ -47,8 +36,8 @@ public class JbandsIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - jmaUp = new(Periods, phase: Phase); - jmaLo = new(Periods, phase: Phase); + jmaUp = new(Period, phase: Phase); + jmaLo = new(Period, phase: Phase); SourceName = Source.ToString(); base.OnInit(); } @@ -63,5 +52,5 @@ public class JbandsIndicator : Indicator, IWatchlistIndicator LbSeries!.SetValue(jmaLo.LowerBand); } - public override string ShortName => $"JBands ({Periods}:{Phase})"; + public override string ShortName => $"JBands ({Period}:{Phase})"; } diff --git a/quantower/Volatility/JvoltyIndicator.cs b/quantower/Volatility/JvoltyIndicator.cs index c3e5146a..75acd818 100644 --- a/quantower/Volatility/JvoltyIndicator.cs +++ b/quantower/Volatility/JvoltyIndicator.cs @@ -5,21 +5,10 @@ namespace QuanTAlib; public class JvoltyIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 14; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 14; - [InputParameter("Data source", sortIndex: 5, variants: [ - "Open", SourceType.Open, - "High", SourceType.High, - "Low", SourceType.Low, - "Close", SourceType.Close, - "HL/2 (Median)", SourceType.HL2, - "OC/2 (Midpoint)", SourceType.OC2, - "OHL/3 (Mean)", SourceType.OHL3, - "HLC/3 (Typical)", SourceType.HLC3, - "OHLC/4 (Average)", SourceType.OHLC4, - "HLCC/4 (Weighted)", SourceType.HLCC4 - ])] + [IndicatorExtensions.DataSourceInput] public SourceType Source { get; set; } = SourceType.Close; private Jma? jma; @@ -41,7 +30,7 @@ public class JvoltyIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - jma = new(Periods); + jma = new(Period); base.OnInit(); } @@ -53,5 +42,5 @@ public class JvoltyIndicator : Indicator, IWatchlistIndicator JvoltySeries!.SetValue(jma.Volty); } - public override string ShortName => $"JVOLTY ({Periods})"; + public override string ShortName => $"JVOLTY ({Period})"; } diff --git a/quantower/Volatility/RealizedIndicator.cs b/quantower/Volatility/RealizedIndicator.cs index 661626f5..eb577130 100644 --- a/quantower/Volatility/RealizedIndicator.cs +++ b/quantower/Volatility/RealizedIndicator.cs @@ -5,15 +5,15 @@ namespace QuanTAlib; public class RealizedIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] - public int Periods { get; set; } = 20; + [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] + public int Period { get; set; } = 20; [InputParameter("Annualized", sortIndex: 2)] public bool IsAnnualized { get; set; } = true; private Rv? realized; protected LineSeries? RvSeries; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public RealizedIndicator() @@ -28,7 +28,7 @@ public class RealizedIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - realized = new(Periods, IsAnnualized); + realized = new(Period, IsAnnualized); base.OnInit(); } @@ -40,5 +40,5 @@ public class RealizedIndicator : Indicator, IWatchlistIndicator RvSeries!.SetValue(result.Value); } - public override string ShortName => $"RV ({Periods}{(IsAnnualized ? " - Annualized" : "")})"; + public override string ShortName => $"RV ({Period}{(IsAnnualized ? " - Annualized" : "")})"; } diff --git a/quantower/Volatility/RviIndicator.cs b/quantower/Volatility/RviIndicator.cs index 516f4ac6..293df279 100644 --- a/quantower/Volatility/RviIndicator.cs +++ b/quantower/Volatility/RviIndicator.cs @@ -5,12 +5,12 @@ namespace QuanTAlib; public class RviIndicator : Indicator, IWatchlistIndicator { - [InputParameter("Periods", sortIndex: 1, 2, 100, 1, 0)] - public int Periods { get; set; } = 10; + [InputParameter("Period", sortIndex: 1, 2, 100, 1, 0)] + public int Period { get; set; } = 10; private Rvi? rvi; protected LineSeries? RviSeries; - public int MinHistoryDepths => Periods; + public int MinHistoryDepths => Period; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; public RviIndicator() @@ -25,7 +25,7 @@ public class RviIndicator : Indicator, IWatchlistIndicator protected override void OnInit() { - rvi = new Rvi(Periods); + rvi = new Rvi(Period); base.OnInit(); } @@ -37,5 +37,5 @@ public class RviIndicator : Indicator, IWatchlistIndicator RviSeries!.SetValue(result.Value); } - public override string ShortName => $"RVI ({Periods})"; + public override string ShortName => $"RVI ({Period})"; }