Periods -> Period, DataSource attribute

This commit is contained in:
Miha Kralj
2024-11-08 17:11:18 -08:00
parent 61a16bd5e3
commit 5bcdf8d614
75 changed files with 370 additions and 1053 deletions
+7 -18
View File
@@ -8,8 +8,8 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator
[InputParameter("Taps (number of weights)", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Taps (number of weights)", sortIndex: 1, 1, 2000, 1, 0)]
public int Taps { get; set; } = 6; public int Taps { get; set; } = 6;
[InputParameter("Periods for lowpass cutoff", sortIndex: 2, 1, 2000, 1, 0)] [InputParameter("Period for lowpass cutoff", sortIndex: 2, 1, 2000, 1, 0)]
public int Periods { get; set; } = 6; public int Period { get; set; } = 6;
[InputParameter("Window Type", sortIndex: 3, variants: [ [InputParameter("Window Type", sortIndex: 3, variants: [
"Rectangular", Afirma.WindowType.Rectangular, "Rectangular", Afirma.WindowType.Rectangular,
@@ -20,18 +20,7 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator
])] ])]
public Afirma.WindowType Window { get; set; } = Afirma.WindowType.Hanning1; public Afirma.WindowType Window { get; set; } = Afirma.WindowType.Hanning1;
[InputParameter("Data source", sortIndex: 4, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -39,7 +28,7 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator
private Afirma? ma; private Afirma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods + Taps; public int MinHistoryDepths => Period + Taps;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public AfirmaIndicator() public AfirmaIndicator()
@@ -50,13 +39,13 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator
Name = "AFIRMA - Adaptive Finite Impulse Response Moving Average"; Name = "AFIRMA - Adaptive Finite Impulse Response Moving Average";
Description = "Adaptive Finite Impulse Response Moving Average with ARMA component"; 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); AddLineSeries(Series);
} }
protected override void OnInit() 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(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -70,7 +59,7 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator
Series!.SetValue(result.Value); 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) public override void OnPaintChart(PaintChartEventArgs args)
{ {
+1 -12
View File
@@ -14,18 +14,7 @@ public class AlmaIndicator : Indicator, IWatchlistIndicator
[InputParameter("Sigma", sortIndex: 3, minimum: 0, maximum: 100, decimalPlaces: 1)] [InputParameter("Sigma", sortIndex: 3, minimum: 0, maximum: 100, decimalPlaces: 1)]
public double Sigma { get; set; } = 6.0; public double Sigma { get; set; } = 6.0;
[InputParameter("Data source", sortIndex: 4, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -8,18 +8,7 @@ public class DemaIndicator : Indicator, IWatchlistIndicator
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -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)] [InputParameter("Scale factor", sortIndex: 2, minimum: 0.01, maximum: 1.0, increment: 0.01, decimalPlaces: 2)]
public double Scale { get; set; } = 0.5; public double Scale { get; set; } = 0.5;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -8,18 +8,7 @@ public class DwmaIndicator : Indicator, IWatchlistIndicator
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+7 -18
View File
@@ -5,23 +5,12 @@ namespace QuanTAlib;
public class EmaIndicator : Indicator, IWatchlistIndicator public class EmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Use SMA for warmup period", sortIndex: 2)] [InputParameter("Use SMA for warmup period", sortIndex: 2)]
public bool UseSMA { get; set; } = false; public bool UseSMA { get; set; } = false;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -30,10 +19,10 @@ public class EmaIndicator : Indicator, IWatchlistIndicator
private Ema? ma; private Ema? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"EMA {Periods}:{SourceName}"; public override string ShortName => $"EMA {Period}:{SourceName}";
public EmaIndicator() public EmaIndicator()
{ {
@@ -42,13 +31,13 @@ public class EmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "EMA - Exponential Moving Average"; Name = "EMA - Exponential Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Ema(Periods, useSma: UseSMA); ma = new Ema(Period, useSma: UseSMA);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class EpmaIndicator : Indicator, IWatchlistIndicator public class EpmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class EpmaIndicator : Indicator, IWatchlistIndicator
private Epma? ma; private Epma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"EPMA {Periods}:{SourceName}"; public override string ShortName => $"EPMA {Period}:{SourceName}";
public EpmaIndicator() public EpmaIndicator()
{ {
@@ -40,13 +29,13 @@ public class EpmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "EPMA - Exponential Percentage Moving Average"; Name = "EPMA - Exponential Percentage Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Epma(Periods); ma = new Epma(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class FramaIndicator : Indicator, IWatchlistIndicator public class FramaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class FramaIndicator : Indicator, IWatchlistIndicator
private Frama? ma; private Frama? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods * 2; public int MinHistoryDepths => Period * 2;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"FRAMA {Periods}:{SourceName}"; public override string ShortName => $"FRAMA {Period}:{SourceName}";
public FramaIndicator() public FramaIndicator()
{ {
@@ -40,13 +29,13 @@ public class FramaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "FRAMA - Fractal Adaptive Moving Average"; Name = "FRAMA - Fractal Adaptive Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Frama(Periods); ma = new Frama(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class FwmaIndicator : Indicator, IWatchlistIndicator public class FwmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class FwmaIndicator : Indicator, IWatchlistIndicator
private Fwma? ma; private Fwma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"FWMA {Periods}:{SourceName}"; public override string ShortName => $"FWMA {Period}:{SourceName}";
public FwmaIndicator() public FwmaIndicator()
{ {
@@ -40,13 +29,13 @@ public class FwmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "FWMA - Fibonacci Weighted Moving Average"; Name = "FWMA - Fibonacci Weighted Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Fwma(Periods); ma = new Fwma(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class GmaIndicator : Indicator, IWatchlistIndicator public class GmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class GmaIndicator : Indicator, IWatchlistIndicator
private Gma? ma; private Gma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"GMA {Periods}:{SourceName}"; public override string ShortName => $"GMA {Period}:{SourceName}";
public GmaIndicator() public GmaIndicator()
{ {
@@ -40,13 +29,13 @@ public class GmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "GMA - Gaussian Moving Average"; Name = "GMA - Gaussian Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Gma(Periods); ma = new Gma(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class HmaIndicator : Indicator, IWatchlistIndicator public class HmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class HmaIndicator : Indicator, IWatchlistIndicator
private Hma? ma; private Hma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; 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; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"HMA {Periods}:{SourceName}"; public override string ShortName => $"HMA {Period}:{SourceName}";
public HmaIndicator() public HmaIndicator()
{ {
@@ -40,13 +29,13 @@ public class HmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "HMA - Hull Moving Average"; Name = "HMA - Hull Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Hma(Periods); ma = new Hma(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+1 -12
View File
@@ -5,18 +5,7 @@ namespace QuanTAlib;
public class HtitIndicator : Indicator, IWatchlistIndicator public class HtitIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Data source", sortIndex: 1, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+8 -19
View File
@@ -5,8 +5,8 @@ namespace QuanTAlib;
public class HwmaIndicator : Indicator, IWatchlistIndicator public class HwmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods (only when nA=nB=nC=0)", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period (only when nA=nB=nC=0)", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("nA", sortIndex: 2, 0, 1, 0.01, 2)] [InputParameter("nA", sortIndex: 2, 0, 1, 0.01, 2)]
public double NA { get; set; } = 0; public double NA { get; set; } = 0;
@@ -17,18 +17,7 @@ public class HwmaIndicator : Indicator, IWatchlistIndicator
[InputParameter("nC", sortIndex: 4, 0, 1, 0.01, 2)] [InputParameter("nC", sortIndex: 4, 0, 1, 0.01, 2)]
public double NC { get; set; } = 0; public double NC { get; set; } = 0;
[InputParameter("Data source", sortIndex: 5, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -37,10 +26,10 @@ public class HwmaIndicator : Indicator, IWatchlistIndicator
private Hwma? ma; private Hwma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; 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() public HwmaIndicator()
{ {
@@ -49,7 +38,7 @@ public class HwmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "HWMA - Holt-Winter Moving Average"; Name = "HWMA - Holt-Winter Moving Average";
Description = "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); AddLineSeries(Series);
} }
@@ -57,11 +46,11 @@ public class HwmaIndicator : Indicator, IWatchlistIndicator
{ {
if ((NA, NB, NC) == (0, 0, 0)) if ((NA, NB, NC) == (0, 0, 0))
{ {
ma = new Hwma(Periods); ma = new Hwma(Period);
} }
else else
{ {
ma = new Hwma(Periods, NA, NB, NC); ma = new Hwma(Period, NA, NB, NC);
} }
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
+7 -18
View File
@@ -5,8 +5,8 @@ namespace QuanTAlib;
public class JmaIndicator : Indicator, IWatchlistIndicator public class JmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Phase", sortIndex: 2, -100, 100, 1, 0)] [InputParameter("Phase", sortIndex: 2, -100, 100, 1, 0)]
public int Phase { get; set; } = 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)] [InputParameter("Beta factor", sortIndex: 3, minimum: 0, maximum: 5, increment: 0.01, decimalPlaces: 2)]
public double Factor { get; set; } = 0.45; public double Factor { get; set; } = 0.45;
[InputParameter("Data source", sortIndex: 4, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -34,10 +23,10 @@ public class JmaIndicator : Indicator, IWatchlistIndicator
private Jma? ma; private Jma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Math.Max(65, Periods * 2); public int MinHistoryDepths => Math.Max(65, Period * 2);
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; 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() public JmaIndicator()
{ {
@@ -46,13 +35,13 @@ public class JmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "JMA - Jurik Moving Average"; Name = "JMA - Jurik Moving Average";
Description = "Jurik Moving Average (Note: This indicator may have consistency issues)"; 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); AddLineSeries(Series);
} }
protected override void OnInit() 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(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,8 +5,8 @@ namespace QuanTAlib;
public class KamaIndicator : Indicator, IWatchlistIndicator public class KamaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Fast", sortIndex: 2, 1, 100, 1, 0)] [InputParameter("Fast", sortIndex: 2, 1, 100, 1, 0)]
public int Fast { get; set; } = 2; public int Fast { get; set; } = 2;
@@ -14,18 +14,7 @@ public class KamaIndicator : Indicator, IWatchlistIndicator
[InputParameter("Slow", sortIndex: 3, 1, 100, 1, 0)] [InputParameter("Slow", sortIndex: 3, 1, 100, 1, 0)]
public int Slow { get; set; } = 30; public int Slow { get; set; } = 30;
[InputParameter("Data source", sortIndex: 4, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -34,10 +23,10 @@ public class KamaIndicator : Indicator, IWatchlistIndicator
private Kama? ma; private Kama? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"KAMA {Periods}:{Fast}:{Slow}:{SourceName}"; public override string ShortName => $"KAMA {Period}:{Fast}:{Slow}:{SourceName}";
public KamaIndicator() public KamaIndicator()
{ {
@@ -46,13 +35,13 @@ public class KamaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "KAMA - Kaufman's Adaptive Moving Average"; Name = "KAMA - Kaufman's Adaptive Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Kama(Periods, Fast, Slow); ma = new Kama(Period, Fast, Slow);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+1 -12
View File
@@ -8,18 +8,7 @@ public class LtmaIndicator : Indicator, IWatchlistIndicator
[InputParameter("Gamma", sortIndex: 1, 0.01, 1, 0.01, 2)] [InputParameter("Gamma", sortIndex: 1, 0.01, 1, 0.01, 2)]
public double Gamma { get; set; } = 0.1; public double Gamma { get; set; } = 0.1;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+7 -18
View File
@@ -5,24 +5,13 @@ namespace QuanTAlib;
public class MaafIndicator : Indicator, IWatchlistIndicator public class MaafIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 3, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 3, 1000, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Threshold", sortIndex: 2, 0.0001, 0.1, 0.0001, 4)] [InputParameter("Threshold", sortIndex: 2, 0.0001, 0.1, 0.0001, 4)]
public double Threshold { get; set; } = 0.002; public double Threshold { get; set; } = 0.002;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -31,10 +20,10 @@ public class MaafIndicator : Indicator, IWatchlistIndicator
private Maaf? ma; private Maaf? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"MAAF {Periods}:{Threshold}:{SourceName}"; public override string ShortName => $"MAAF {Period}:{Threshold}:{SourceName}";
public MaafIndicator() public MaafIndicator()
{ {
@@ -43,13 +32,13 @@ public class MaafIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "MAAF - Median Adaptive Averaging Filter"; Name = "MAAF - Median Adaptive Averaging Filter";
Description = "Median Adaptive Averaging Filter (Note: This indicator may have consistency issues)"; 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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Maaf(Periods, Threshold); ma = new Maaf(Period, Threshold);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+1 -12
View File
@@ -11,18 +11,7 @@ public class MamaIndicator : Indicator, IWatchlistIndicator
[InputParameter("Slow Limit", sortIndex: 2, 0.01, 1, 0.01, 2)] [InputParameter("Slow Limit", sortIndex: 2, 0.01, 1, 0.01, 2)]
public double SlowLimit { get; set; } = 0.05; public double SlowLimit { get; set; } = 0.05;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+7 -18
View File
@@ -5,24 +5,13 @@ namespace QuanTAlib;
public class MgdiIndicator : Indicator, IWatchlistIndicator public class MgdiIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("K-Factor", sortIndex: 2, 0.1, 2, 0.1, 1)] [InputParameter("K-Factor", sortIndex: 2, 0.1, 2, 0.1, 1)]
public double KFactor { get; set; } = 0.6; public double KFactor { get; set; } = 0.6;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -31,10 +20,10 @@ public class MgdiIndicator : Indicator, IWatchlistIndicator
private Mgdi? ma; private Mgdi? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"MGDI {Periods}:{KFactor}:{SourceName}"; public override string ShortName => $"MGDI {Period}:{KFactor}:{SourceName}";
public MgdiIndicator() public MgdiIndicator()
{ {
@@ -43,13 +32,13 @@ public class MgdiIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "MGDI - McGinley Dynamic Indicator"; Name = "MGDI - McGinley Dynamic Indicator";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Mgdi(Periods, KFactor); ma = new Mgdi(Period, KFactor);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class MmaIndicator : Indicator, IWatchlistIndicator public class MmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class MmaIndicator : Indicator, IWatchlistIndicator
private Mma? ma; private Mma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"MMA {Periods}:{SourceName}"; public override string ShortName => $"MMA {Period}:{SourceName}";
public MmaIndicator() public MmaIndicator()
{ {
@@ -40,13 +29,13 @@ public class MmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "MMA - Modified Moving Average"; Name = "MMA - Modified Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Mma(Periods); ma = new Mma(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class PwmaIndicator : Indicator, IWatchlistIndicator public class PwmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class PwmaIndicator : Indicator, IWatchlistIndicator
private Pwma? ma; private Pwma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"PWMA {Periods}:{SourceName}"; public override string ShortName => $"PWMA {Period}:{SourceName}";
public PwmaIndicator() public PwmaIndicator()
{ {
@@ -40,13 +29,13 @@ public class PwmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "PWMA - Pascal's Weighted Moving Average"; Name = "PWMA - Pascal's Weighted Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Pwma(Periods); ma = new Pwma(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,24 +5,13 @@ namespace QuanTAlib;
public class RemaIndicator : Indicator, IWatchlistIndicator public class RemaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Lambda", sortIndex: 2, 0, 1, 0.01, 2)] [InputParameter("Lambda", sortIndex: 2, 0, 1, 0.01, 2)]
public double Lambda { get; set; } = 0.5; public double Lambda { get; set; } = 0.5;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -31,10 +20,10 @@ public class RemaIndicator : Indicator, IWatchlistIndicator
private Rema? ma; private Rema? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"REMA {Periods}:{Lambda}:{SourceName}"; public override string ShortName => $"REMA {Period}:{Lambda}:{SourceName}";
public RemaIndicator() public RemaIndicator()
{ {
@@ -43,13 +32,13 @@ public class RemaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "REMA - Regularized Exponential Moving Average"; Name = "REMA - Regularized Exponential Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Rema(Periods, Lambda); ma = new Rema(Period, Lambda);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class RmaIndicator : Indicator, IWatchlistIndicator public class RmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class RmaIndicator : Indicator, IWatchlistIndicator
private Rma? ma; private Rma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods * 2; public int MinHistoryDepths => Period * 2;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"RMA {Periods}:{SourceName}"; public override string ShortName => $"RMA {Period}:{SourceName}";
public RmaIndicator() public RmaIndicator()
{ {
@@ -40,13 +29,13 @@ public class RmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "RMA - Relative Moving Average (Wilder's Moving Average)"; Name = "RMA - Relative Moving Average (Wilder's Moving Average)";
Description = "Relative Moving Average, also known as 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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Rma(Periods); ma = new Rma(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class SinemaIndicator : Indicator, IWatchlistIndicator public class SinemaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class SinemaIndicator : Indicator, IWatchlistIndicator
private Sinema? ma; private Sinema? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"SINEMA {Periods}:{SourceName}"; public override string ShortName => $"SINEMA {Period}:{SourceName}";
public SinemaIndicator() public SinemaIndicator()
{ {
@@ -40,13 +29,13 @@ public class SinemaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "SINEMA - Sine-Weighted Moving Average"; Name = "SINEMA - Sine-Weighted Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Sinema(Periods); ma = new Sinema(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+1 -12
View File
@@ -8,18 +8,7 @@ public class SmaIndicator : Indicator, IWatchlistIndicator
[InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Period { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class SmmaIndicator : Indicator, IWatchlistIndicator public class SmmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class SmmaIndicator : Indicator, IWatchlistIndicator
private Smma? ma; private Smma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"SMMA {Periods}:{SourceName}"; public override string ShortName => $"SMMA {Period}:{SourceName}";
public SmmaIndicator() public SmmaIndicator()
{ {
@@ -40,13 +29,13 @@ public class SmmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "SMMA - Smoothed Moving Average"; Name = "SMMA - Smoothed Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Smma(Periods); ma = new Smma(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,8 +5,8 @@ namespace QuanTAlib;
public class T3Indicator : Indicator, IWatchlistIndicator public class T3Indicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Volume Factor", sortIndex: 2, 0, 1, 0.01, 2)] [InputParameter("Volume Factor", sortIndex: 2, 0, 1, 0.01, 2)]
public double VolumeFactor { get; set; } = 0.7; public double VolumeFactor { get; set; } = 0.7;
@@ -14,18 +14,7 @@ public class T3Indicator : Indicator, IWatchlistIndicator
[InputParameter("Use SMA", sortIndex: 3)] [InputParameter("Use SMA", sortIndex: 3)]
public bool UseSma { get; set; } = true; public bool UseSma { get; set; } = true;
[InputParameter("Data source", sortIndex: 4, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -34,10 +23,10 @@ public class T3Indicator : Indicator, IWatchlistIndicator
private T3? ma; private T3? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"T3 {Periods}:{VolumeFactor}:{UseSma}:{SourceName}"; public override string ShortName => $"T3 {Period}:{VolumeFactor}:{UseSma}:{SourceName}";
public T3Indicator() public T3Indicator()
{ {
@@ -46,13 +35,13 @@ public class T3Indicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "T3 - Tillson T3 Moving Average"; Name = "T3 - Tillson T3 Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new T3(Periods, VolumeFactor, UseSma); ma = new T3(Period, VolumeFactor, UseSma);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class TemaIndicator : Indicator, IWatchlistIndicator public class TemaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class TemaIndicator : Indicator, IWatchlistIndicator
private Tema? ma; private Tema? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; 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; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"TEMA {Periods}:{SourceName}"; public override string ShortName => $"TEMA {Period}:{SourceName}";
public TemaIndicator() public TemaIndicator()
{ {
@@ -40,13 +29,13 @@ public class TemaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "TEMA - Triple Exponential Moving Average"; Name = "TEMA - Triple Exponential Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Tema(Periods); ma = new Tema(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class TrimaIndicator : Indicator, IWatchlistIndicator public class TrimaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class TrimaIndicator : Indicator, IWatchlistIndicator
private Trima? ma; private Trima? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"TRIMA {Periods}:{SourceName}"; public override string ShortName => $"TRIMA {Period}:{SourceName}";
public TrimaIndicator() public TrimaIndicator()
{ {
@@ -40,13 +29,13 @@ public class TrimaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "TRIMA - Triangular Moving Average"; Name = "TRIMA - Triangular Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Trima(Periods); ma = new Trima(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+2 -13
View File
@@ -13,19 +13,8 @@ public class VidyaIndicator : Indicator, IWatchlistIndicator
[InputParameter("Alpha", sortIndex: 3, 0.01, 1, 0.01, 2)] [InputParameter("Alpha", sortIndex: 3, 0.01, 1, 0.01, 2)]
public double Alpha { get; set; } = 0.2; public double Alpha { get; set; } = 0.2;
[InputParameter("Data source", sortIndex: 4, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class WmaIndicator : Indicator, IWatchlistIndicator public class WmaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,10 +17,10 @@ public class WmaIndicator : Indicator, IWatchlistIndicator
private Wma? ma; private Wma? ma;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"WMA {Periods}:{SourceName}"; public override string ShortName => $"WMA {Period}:{SourceName}";
public WmaIndicator() public WmaIndicator()
{ {
@@ -40,13 +29,13 @@ public class WmaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "WMA - Weighted Moving Average"; Name = "WMA - Weighted Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new Wma(Periods); ma = new Wma(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+8 -19
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class ZlemaIndicator : Indicator, IWatchlistIndicator public class ZlemaIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -29,10 +18,10 @@ public class ZlemaIndicator : Indicator, IWatchlistIndicator
private Huber? err; private Huber? err;
protected LineSeries? Series; protected LineSeries? Series;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public override string ShortName => $"ZLEMA {Periods}:{SourceName}"; public override string ShortName => $"ZLEMA {Period}:{SourceName}";
public ZlemaIndicator() public ZlemaIndicator()
{ {
@@ -41,14 +30,14 @@ public class ZlemaIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
Name = "ZLEMA - Zero Lag Exponential Moving Average"; Name = "ZLEMA - Zero Lag Exponential Moving Average";
Description = "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); AddLineSeries(Series);
} }
protected override void OnInit() protected override void OnInit()
{ {
ma = new(Periods); ma = new(Period);
err = new(Periods); err = new(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
+1 -12
View File
@@ -9,18 +9,7 @@ public class ConvolutionIndicator : Indicator, IWatchlistIndicator
[InputParameter("Kernel (comma/space/semicolon separated numbers)", sortIndex: 1)] [InputParameter("Kernel (comma/space/semicolon separated numbers)", sortIndex: 1)]
public string KernelString { get; set; } = "0.25, 0.5, 0.25, -0.5"; public string KernelString { get; set; } = "0.25, 0.5, 0.25, -0.5";
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -17,18 +17,7 @@ public class QemaIndicator : Indicator, IWatchlistIndicator
[InputParameter("K4", sortIndex: 4, 0.01, 1, 0.01, 2)] [InputParameter("K4", sortIndex: 4, 0.01, 1, 0.01, 2)]
public double K4 { get; set; } = 0.2; public double K4 { get; set; } = 0.2;
[InputParameter("Data source", sortIndex: 5, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -8,18 +8,7 @@ public class TestIndicator : Indicator, IWatchlistIndicator
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Data source", sortIndex: 20, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+20
View File
@@ -24,6 +24,26 @@ public static class IndicatorExtensions
public static readonly Color Momentum = Color.FromArgb(128, 255, 255); // #80FFFF - Cyan public static readonly Color Momentum = Color.FromArgb(128, 255, 255); // #80FFFF - Cyan
public static readonly Color Experiments = Color.FromArgb(255, 165, 0); // #FFA500 - Orange 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) public static TValue GetInputValue(this Indicator indicator, UpdateArgs args, SourceType source)
{ {
var historicalData = indicator.HistoricalData; var historicalData = indicator.HistoricalData;
+6 -6
View File
@@ -5,15 +5,15 @@ namespace QuanTAlib;
public class AdxIndicator : Indicator, IWatchlistIndicator public class AdxIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
public bool ShowColdValues { get; set; } = true; public bool ShowColdValues { get; set; } = true;
private Adx? adx; private Adx? adx;
protected LineSeries? AdxSeries; 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; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public AdxIndicator() public AdxIndicator()
@@ -22,13 +22,13 @@ public class AdxIndicator : Indicator, IWatchlistIndicator
Description = "Measures the strength of a trend, regardless of its direction."; Description = "Measures the strength of a trend, regardless of its direction.";
SeparateWindow = true; SeparateWindow = true;
AdxSeries = new($"ADX {Periods}", color: IndicatorExtensions.Momentum, 2, LineStyle.Solid); AdxSeries = new($"ADX {Period}", color: IndicatorExtensions.Momentum, 2, LineStyle.Solid);
AddLineSeries(AdxSeries); AddLineSeries(AdxSeries);
} }
protected override void OnInit() protected override void OnInit()
{ {
adx = new Adx(Periods); adx = new Adx(Period);
base.OnInit(); base.OnInit();
} }
@@ -43,7 +43,7 @@ public class AdxIndicator : Indicator, IWatchlistIndicator
#pragma warning disable CA1416 // Validate platform compatibility #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) public override void OnPaintChart(PaintChartEventArgs args)
{ {
+6 -6
View File
@@ -5,15 +5,15 @@ namespace QuanTAlib;
public class AdxrIndicator : Indicator, IWatchlistIndicator public class AdxrIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
public bool ShowColdValues { get; set; } = true; public bool ShowColdValues { get; set; } = true;
private Adxr? adxr; private Adxr? adxr;
protected LineSeries? AdxrSeries; 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; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public AdxrIndicator() public AdxrIndicator()
@@ -22,13 +22,13 @@ public class AdxrIndicator : Indicator, IWatchlistIndicator
Description = "Measures trend strength by comparing current ADX with historical ADX values."; Description = "Measures trend strength by comparing current ADX with historical ADX values.";
SeparateWindow = true; SeparateWindow = true;
AdxrSeries = new($"ADXR {Periods}", Color.Blue, 2, LineStyle.Solid); AdxrSeries = new($"ADXR {Period}", Color.Blue, 2, LineStyle.Solid);
AddLineSeries(AdxrSeries); AddLineSeries(AdxrSeries);
} }
protected override void OnInit() protected override void OnInit()
{ {
adxr = new Adxr(Periods); adxr = new Adxr(Period);
base.OnInit(); base.OnInit();
} }
@@ -43,7 +43,7 @@ public class AdxrIndicator : Indicator, IWatchlistIndicator
#pragma warning disable CA1416 // Validate platform compatibility #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) public override void OnPaintChart(PaintChartEventArgs args)
{ {
+1 -12
View File
@@ -11,18 +11,7 @@ public class ApoIndicator : Indicator, IWatchlistIndicator
[InputParameter("Slow Period", sortIndex: 2, 1, 2000, 1, 0)] [InputParameter("Slow Period", sortIndex: 2, 1, 2000, 1, 0)]
public int SlowPeriod { get; set; } = 26; public int SlowPeriod { get; set; } = 26;
[InputParameter("Data source", sortIndex: 4, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
+8 -8
View File
@@ -5,8 +5,8 @@ namespace QuanTAlib;
public class DmiIndicator : Indicator, IWatchlistIndicator public class DmiIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
public bool ShowColdValues { get; set; } = true; public bool ShowColdValues { get; set; } = true;
@@ -14,7 +14,7 @@ public class DmiIndicator : Indicator, IWatchlistIndicator
private Dmi? dmi; private Dmi? dmi;
protected LineSeries? PlusDiSeries; protected LineSeries? PlusDiSeries;
protected LineSeries? MinusDiSeries; protected LineSeries? MinusDiSeries;
public int MinHistoryDepths => Math.Max(5, Periods * 2); public int MinHistoryDepths => Math.Max(5, Period * 2);
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public DmiIndicator() 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."; Description = "Identifies the directional movement of a price by comparing successive highs and lows.";
SeparateWindow = true; SeparateWindow = true;
PlusDiSeries = new($"+DI {Periods}", color: Color.Red, 2, LineStyle.Solid); PlusDiSeries = new($"+DI {Period}", color: Color.Red, 2, LineStyle.Solid);
MinusDiSeries = new($"-DI {Periods}", color: Color.Blue, 2, LineStyle.Solid); MinusDiSeries = new($"-DI {Period}", color: Color.Blue, 2, LineStyle.Solid);
AddLineSeries(PlusDiSeries); AddLineSeries(PlusDiSeries);
AddLineSeries(MinusDiSeries); AddLineSeries(MinusDiSeries);
} }
protected override void OnInit() protected override void OnInit()
{ {
dmi = new Dmi(Periods); dmi = new Dmi(Period);
base.OnInit(); base.OnInit();
} }
protected override void OnUpdate(UpdateArgs args) protected override void OnUpdate(UpdateArgs args)
{ {
TBar input = IndicatorExtensions.GetInputBar(this, args); TBar input = IndicatorExtensions.GetInputBar(this, args);
var result = dmi!.Calc(input); dmi!.Calc(input);
PlusDiSeries!.SetValue(dmi.PlusDI); PlusDiSeries!.SetValue(dmi.PlusDI);
MinusDiSeries!.SetValue(dmi.MinusDI); MinusDiSeries!.SetValue(dmi.MinusDI);
@@ -48,7 +48,7 @@ public class DmiIndicator : Indicator, IWatchlistIndicator
#pragma warning disable CA1416 // Validate platform compatibility #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) public override void OnPaintChart(PaintChartEventArgs args)
{ {
+10 -10
View File
@@ -5,11 +5,11 @@ namespace QuanTAlib;
public class DmxIndicator : Indicator, IWatchlistIndicator public class DmxIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("DMI Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("DMI Period", sortIndex: 1, 1, 2000, 1, 0)]
public int DmiPeriods { get; set; } = 14; public int DmiPeriod { get; set; } = 14;
[InputParameter("JMA Smoothing Periods", sortIndex: 2, 1, 2000, 1, 0)] [InputParameter("JMA Smoothing Period", sortIndex: 2, 1, 2000, 1, 0)]
public int JmaPeriods { get; set; } = 12; public int JmaPeriod { get; set; } = 12;
[InputParameter("JMA Phase", sortIndex: 3, -100, 100, 1, 0)] [InputParameter("JMA Phase", sortIndex: 3, -100, 100, 1, 0)]
public int JmaPhase { get; set; } = 100; public int JmaPhase { get; set; } = 100;
@@ -23,7 +23,7 @@ public class DmxIndicator : Indicator, IWatchlistIndicator
private Dmx? dmx; private Dmx? dmx;
protected LineSeries? PlusDiSeries; protected LineSeries? PlusDiSeries;
protected LineSeries? MinusDiSeries; 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; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public DmxIndicator() 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."; Description = "An enhanced version of DMI using JMA smoothing for better noise reduction and responsiveness.";
SeparateWindow = true; SeparateWindow = true;
PlusDiSeries = new($"+DI {DmiPeriods}", color: Color.Red, 2, LineStyle.Solid); PlusDiSeries = new($"+DI {DmiPeriod}", color: Color.Red, 2, LineStyle.Solid);
MinusDiSeries = new($"-DI {DmiPeriods}", color: Color.Blue, 2, LineStyle.Solid); MinusDiSeries = new($"-DI {DmiPeriod}", color: Color.Blue, 2, LineStyle.Solid);
AddLineSeries(PlusDiSeries); AddLineSeries(PlusDiSeries);
AddLineSeries(MinusDiSeries); AddLineSeries(MinusDiSeries);
} }
protected override void OnInit() protected override void OnInit()
{ {
dmx = new Dmx(DmiPeriods, JmaPeriods, JmaPhase, JmaFactor); dmx = new Dmx(DmiPeriod, JmaPeriod, JmaPhase, JmaFactor);
base.OnInit(); base.OnInit();
} }
protected override void OnUpdate(UpdateArgs args) protected override void OnUpdate(UpdateArgs args)
{ {
TBar input = IndicatorExtensions.GetInputBar(this, args); TBar input = IndicatorExtensions.GetInputBar(this, args);
var result = dmx!.Calc(input); dmx!.Calc(input);
PlusDiSeries!.SetValue(dmx.PlusDI); PlusDiSeries!.SetValue(dmx.PlusDI);
MinusDiSeries!.SetValue(dmx.MinusDI); MinusDiSeries!.SetValue(dmx.MinusDI);
@@ -57,7 +57,7 @@ public class DmxIndicator : Indicator, IWatchlistIndicator
#pragma warning disable CA1416 // Validate platform compatibility #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) public override void OnPaintChart(PaintChartEventArgs args)
{ {
+1 -12
View File
@@ -8,18 +8,7 @@ public class DpoIndicator : Indicator, IWatchlistIndicator
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 3)] [InputParameter("Show cold values", sortIndex: 3)]
+1 -12
View File
@@ -19,18 +19,7 @@ public class MacdIndicator : Indicator, IWatchlistIndicator
[InputParameter("Use SMA for warmup period", sortIndex: 2)] [InputParameter("Use SMA for warmup period", sortIndex: 2)]
public bool UseSMA { get; set; } = false; public bool UseSMA { get; set; } = false;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -8,18 +8,7 @@ public class MomIndicator : Indicator
[InputParameter("Period", sortIndex: 1, minimum: 1, maximum: 2000, increment: 1)] [InputParameter("Period", sortIndex: 1, minimum: 1, maximum: 2000, increment: 1)]
public int Period { get; set; } = 10; public int Period { get; set; } = 10;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -11,18 +11,7 @@ public class PmoIndicator : Indicator
[InputParameter("Second Period", sortIndex: 2, minimum: 1, maximum: 2000, increment: 1)] [InputParameter("Second Period", sortIndex: 2, minimum: 1, maximum: 2000, increment: 1)]
public int Period2 { get; set; } = 20; public int Period2 { get; set; } = 20;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -11,18 +11,7 @@ public class PoIndicator : Indicator
[InputParameter("Slow Period", sortIndex: 2, minimum: 1, maximum: 2000, increment: 1)] [InputParameter("Slow Period", sortIndex: 2, minimum: 1, maximum: 2000, increment: 1)]
public int SlowPeriod { get; set; } = 21; public int SlowPeriod { get; set; } = 21;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -11,18 +11,7 @@ public class PpoIndicator : Indicator
[InputParameter("Slow Period", sortIndex: 2, minimum: 1, maximum: 2000, increment: 1)] [InputParameter("Slow Period", sortIndex: 2, minimum: 1, maximum: 2000, increment: 1)]
public int SlowPeriod { get; set; } = 26; public int SlowPeriod { get; set; } = 26;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -8,18 +8,7 @@ public class RocIndicator : Indicator, IWatchlistIndicator
[InputParameter("Period", sortIndex: 1, minimum: 1, maximum: 2000, increment: 1)] [InputParameter("Period", sortIndex: 1, minimum: 1, maximum: 2000, increment: 1)]
public int Period { get; set; } = 12; public int Period { get; set; } = 12;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -8,18 +8,7 @@ public class TrixIndicator : Indicator
[InputParameter("Period", sortIndex: 1, minimum: 1, maximum: 2000, increment: 1)] [InputParameter("Period", sortIndex: 1, minimum: 1, maximum: 2000, increment: 1)]
public int Period { get; set; } = 18; public int Period { get; set; } = 18;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+1 -12
View File
@@ -14,18 +14,7 @@ public class VelIndicator : Indicator, IWatchlistIndicator
[InputParameter("Factor", sortIndex: 3, minimum: 0.1, maximum: 0.9, increment: 0.1, decimalPlaces: 2)] [InputParameter("Factor", sortIndex: 3, minimum: 0.1, maximum: 0.9, increment: 0.1, decimalPlaces: 2)]
public double Factor { get; set; } = 0.25; public double Factor { get; set; } = 0.25;
[InputParameter("Data source", sortIndex: 4, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+8 -8
View File
@@ -5,8 +5,8 @@ namespace QuanTAlib;
public class VortexIndicator : Indicator, IWatchlistIndicator public class VortexIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
public bool ShowColdValues { get; set; } = true; public bool ShowColdValues { get; set; } = true;
@@ -16,7 +16,7 @@ public class VortexIndicator : Indicator, IWatchlistIndicator
protected LineSeries? PlusLine; protected LineSeries? PlusLine;
protected LineSeries? MinusLine; protected LineSeries? MinusLine;
protected LineSeries? ZeroLine; protected LineSeries? ZeroLine;
public int MinHistoryDepths => Math.Max(5, Periods * 2); public int MinHistoryDepths => Math.Max(5, Period * 2);
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public VortexIndicator() public VortexIndicator()
@@ -25,9 +25,9 @@ public class VortexIndicator : Indicator, IWatchlistIndicator
Description = "A technical indicator consisting of two oscillating lines that identify trend reversals"; Description = "A technical indicator consisting of two oscillating lines that identify trend reversals";
SeparateWindow = true; SeparateWindow = true;
ValueSeries = new($"VORTEX({Periods})", color: IndicatorExtensions.Momentum, 2, LineStyle.Solid); ValueSeries = new($"VORTEX({Period})", color: IndicatorExtensions.Momentum, 2, LineStyle.Solid);
PlusLine = new($"VI+({Periods})", color: Color.Green, 2, LineStyle.Solid); PlusLine = new($"VI+({Period})", color: Color.Green, 2, LineStyle.Solid);
MinusLine = new($"VI-({Periods})", color: Color.Red, 2, LineStyle.Solid); MinusLine = new($"VI-({Period})", color: Color.Red, 2, LineStyle.Solid);
ZeroLine = new("Zero", Color.Gray, 1, LineStyle.Dot); ZeroLine = new("Zero", Color.Gray, 1, LineStyle.Dot);
AddLineSeries(ValueSeries); AddLineSeries(ValueSeries);
@@ -38,7 +38,7 @@ public class VortexIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
vortex = new Vortex(Periods); vortex = new Vortex(Period);
base.OnInit(); base.OnInit();
} }
@@ -59,7 +59,7 @@ public class VortexIndicator : Indicator, IWatchlistIndicator
#pragma warning disable CA1416 // Validate platform compatibility #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) public override void OnPaintChart(PaintChartEventArgs args)
{ {
+1 -13
View File
@@ -8,19 +8,7 @@ namespace QuanTAlib
[InputParameter("Period", 0, 1, 100, 1, 0)] [InputParameter("Period", 0, 1, 100, 1, 0)]
public int Period { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Source Type", 1, variants: new object[] [IndicatorExtensions.DataSourceInput]
{
"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
})]
public SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show Cold Values", 2)] [InputParameter("Show Cold Values", 2)]
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class RsiIndicator : Indicator, IWatchlistIndicator public class RsiIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 5, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,7 +17,7 @@ public class RsiIndicator : Indicator, IWatchlistIndicator
private Rsi? rsi; private Rsi? rsi;
protected string? SourceName; protected string? SourceName;
protected LineSeries? RsiSeries; protected LineSeries? RsiSeries;
public int MinHistoryDepths => Periods + 1; public int MinHistoryDepths => Period + 1;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public RsiIndicator() 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."; Description = "Measures the speed and magnitude of recent price changes to evaluate overbought or oversold conditions.";
SeparateWindow = true; SeparateWindow = true;
SourceName = Source.ToString(); 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); AddLineSeries(RsiSeries);
} }
protected override void OnInit() protected override void OnInit()
{ {
rsi = new Rsi(Periods); rsi = new Rsi(Period);
base.OnInit(); base.OnInit();
} }
@@ -56,7 +45,7 @@ public class RsiIndicator : Indicator, IWatchlistIndicator
RsiSeries!.SetMarker(0, Color.Transparent); 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 #pragma warning disable CA1416 // Validate platform compatibility
public override void OnPaintChart(PaintChartEventArgs args) public override void OnPaintChart(PaintChartEventArgs args)
+1 -12
View File
@@ -8,18 +8,7 @@ public class RsxIndicator : Indicator, IWatchlistIndicator
[InputParameter("Rsi Period", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Rsi Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 5, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
+8 -17
View File
@@ -5,28 +5,17 @@ namespace QuanTAlib;
public class CurvatureIndicator : Indicator, IWatchlistIndicator public class CurvatureIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 3, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 3, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Curvature? curvature; private Curvature? curvature;
protected LineSeries? CurvatureSeries; protected LineSeries? CurvatureSeries;
protected LineSeries? LineSeries; protected LineSeries? LineSeries;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => (Periods * 2) - 1; public int MinHistoryDepths => (Period * 2) - 1;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public CurvatureIndicator() public CurvatureIndicator()
@@ -37,12 +26,14 @@ public class CurvatureIndicator : Indicator, IWatchlistIndicator
SourceName = Source.ToString(); SourceName = Source.ToString();
CurvatureSeries = new("Curvature", color: IndicatorExtensions.Statistics, 2, LineStyle.Solid); CurvatureSeries = new("Curvature", color: IndicatorExtensions.Statistics, 2, LineStyle.Solid);
LineSeries = new("Line", color: Color.Red, 1, LineStyle.Solid);
AddLineSeries(CurvatureSeries); AddLineSeries(CurvatureSeries);
AddLineSeries(LineSeries);
} }
protected override void OnInit() protected override void OnInit()
{ {
curvature = new Curvature(Periods); curvature = new Curvature(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); 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})";
} }
+5 -16
View File
@@ -4,21 +4,10 @@ namespace QuanTAlib;
public class EntropyIndicator : Indicator, IWatchlistIndicator public class EntropyIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Entropy? entropy; private Entropy? entropy;
@@ -40,7 +29,7 @@ public class EntropyIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
entropy = new Entropy(Periods); entropy = new Entropy(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -53,5 +42,5 @@ public class EntropyIndicator : Indicator, IWatchlistIndicator
EntropySeries!.SetValue(result.Value); EntropySeries!.SetValue(result.Value);
} }
public override string ShortName => $"Entropy ({Periods}:{SourceName})"; public override string ShortName => $"Entropy ({Period}:{SourceName})";
} }
+6 -17
View File
@@ -5,27 +5,16 @@ namespace QuanTAlib;
public class KurtosisIndicator : Indicator, IWatchlistIndicator public class KurtosisIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 4, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 4, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Kurtosis? kurtosis; private Kurtosis? kurtosis;
protected LineSeries? KurtosisSeries; protected LineSeries? KurtosisSeries;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods - 1; public int MinHistoryDepths => Period - 1;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public KurtosisIndicator() public KurtosisIndicator()
@@ -41,7 +30,7 @@ public class KurtosisIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
kurtosis = new Kurtosis(Periods); kurtosis = new Kurtosis(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -54,5 +43,5 @@ public class KurtosisIndicator : Indicator, IWatchlistIndicator
KurtosisSeries!.SetValue(result.Value); KurtosisSeries!.SetValue(result.Value);
} }
public override string ShortName => $"Kurtosis ({Periods}:{SourceName})"; public override string ShortName => $"Kurtosis ({Period}:{SourceName})";
} }
+5 -16
View File
@@ -5,24 +5,13 @@ namespace QuanTAlib;
public class MaxIndicator : Indicator, IWatchlistIndicator public class MaxIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Decay", sortIndex: 2, 0, 10, 0.01, 2)] [InputParameter("Decay", sortIndex: 2, 0, 10, 0.01, 2)]
public double Decay { get; set; } = 0; public double Decay { get; set; } = 0;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.High; public SourceType Source { get; set; } = SourceType.High;
private Max? ma; private Max? ma;
@@ -44,7 +33,7 @@ public class MaxIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
ma = new Max(Periods, Decay); ma = new Max(Period, Decay);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -57,5 +46,5 @@ public class MaxIndicator : Indicator, IWatchlistIndicator
MaxSeries!.SetValue(result.Value); MaxSeries!.SetValue(result.Value);
} }
public override string ShortName => $"Max ({Periods}, {Decay:F2}:{SourceName})"; public override string ShortName => $"Max ({Period}, {Decay:F2}:{SourceName})";
} }
+6 -17
View File
@@ -5,27 +5,16 @@ namespace QuanTAlib;
public class MedianIndicator : Indicator, IWatchlistIndicator public class MedianIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Median? med; private Median? med;
protected LineSeries? MedianSeries; protected LineSeries? MedianSeries;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public MedianIndicator() public MedianIndicator()
@@ -41,7 +30,7 @@ public class MedianIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
med = new Median(Periods); med = new Median(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -54,5 +43,5 @@ public class MedianIndicator : Indicator, IWatchlistIndicator
MedianSeries!.SetValue(result.Value); MedianSeries!.SetValue(result.Value);
} }
public override string ShortName => $"Median ({Periods}:{SourceName})"; public override string ShortName => $"Median ({Period}:{SourceName})";
} }
+5 -16
View File
@@ -5,24 +5,13 @@ namespace QuanTAlib;
public class MinIndicator : Indicator, IWatchlistIndicator public class MinIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Decay", sortIndex: 2, 0, 10, 0.01, 2)] [InputParameter("Decay", sortIndex: 2, 0, 10, 0.01, 2)]
public double Decay { get; set; } = 0; public double Decay { get; set; } = 0;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Low; public SourceType Source { get; set; } = SourceType.Low;
private Min? mi; private Min? mi;
@@ -44,7 +33,7 @@ public class MinIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
mi = new Min(Periods, Decay); mi = new Min(Period, Decay);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -57,5 +46,5 @@ public class MinIndicator : Indicator, IWatchlistIndicator
MinSeries!.SetValue(result.Value); MinSeries!.SetValue(result.Value);
} }
public override string ShortName => $"Min ({Periods}, {Decay:F2}:{SourceName})"; public override string ShortName => $"Min ({Period}, {Decay:F2}:{SourceName})";
} }
+6 -17
View File
@@ -5,27 +5,16 @@ namespace QuanTAlib;
public class ModeIndicator : Indicator, IWatchlistIndicator public class ModeIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Mode? mode; private Mode? mode;
protected LineSeries? ModeSeries; protected LineSeries? ModeSeries;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public ModeIndicator() public ModeIndicator()
@@ -41,7 +30,7 @@ public class ModeIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
mode = new Mode(Periods); mode = new Mode(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -54,5 +43,5 @@ public class ModeIndicator : Indicator, IWatchlistIndicator
ModeSeries!.SetValue(result.Value); ModeSeries!.SetValue(result.Value);
} }
public override string ShortName => $"Mode ({Periods}:{SourceName})"; public override string ShortName => $"Mode ({Period}:{SourceName})";
} }
+5 -16
View File
@@ -5,24 +5,13 @@ namespace QuanTAlib;
public class PercentileIndicator : Indicator, IWatchlistIndicator public class PercentileIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Percentile", sortIndex: 2, 0, 100, 0.1, 1)] [InputParameter("Percentile", sortIndex: 2, 0, 100, 0.1, 1)]
public double PercentileValue { get; set; } = 50; public double PercentileValue { get; set; } = 50;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Percentile? percentile; private Percentile? percentile;
@@ -44,7 +33,7 @@ public class PercentileIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
percentile = new Percentile(Periods, PercentileValue); percentile = new Percentile(Period, PercentileValue);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -57,5 +46,5 @@ public class PercentileIndicator : Indicator, IWatchlistIndicator
PercentileSeries!.SetValue(result.Value); PercentileSeries!.SetValue(result.Value);
} }
public override string ShortName => $"Percentile ({Periods}, {PercentileValue}%:{SourceName})"; public override string ShortName => $"Percentile ({Period}, {PercentileValue}%:{SourceName})";
} }
+5 -16
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class SkewIndicator : Indicator, IWatchlistIndicator public class SkewIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 3, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 3, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Skew? skew; private Skew? skew;
@@ -41,7 +30,7 @@ public class SkewIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
skew = new Skew(Periods); skew = new Skew(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -54,5 +43,5 @@ public class SkewIndicator : Indicator, IWatchlistIndicator
SkewSeries!.SetValue(result.Value); SkewSeries!.SetValue(result.Value);
} }
public override string ShortName => $"Skew ({Periods}:{SourceName})"; public override string ShortName => $"Skew ({Period}:{SourceName})";
} }
+6 -17
View File
@@ -5,28 +5,17 @@ namespace QuanTAlib;
public class SlopeIndicator : Indicator, IWatchlistIndicator public class SlopeIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Slope? slope; private Slope? slope;
protected LineSeries? SlopeSeries; protected LineSeries? SlopeSeries;
protected LineSeries? LineSeries; protected LineSeries? LineSeries;
protected string? SourceName; protected string? SourceName;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public SlopeIndicator() public SlopeIndicator()
@@ -44,7 +33,7 @@ public class SlopeIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
slope = new Slope(Periods); slope = new Slope(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -65,7 +54,7 @@ public class SlopeIndicator : Indicator, IWatchlistIndicator
{ {
get get
{ {
var result = $"Slope ({Periods}:{SourceName})"; var result = $"Slope ({Period}:{SourceName})";
if (slope != null) if (slope != null)
{ {
result += $" Slope: {Math.Round(SlopeSeries!.GetValue(), 6)}"; result += $" Slope: {Math.Round(SlopeSeries!.GetValue(), 6)}";
+5 -16
View File
@@ -5,24 +5,13 @@ namespace QuanTAlib;
public class StddevIndicator : Indicator, IWatchlistIndicator public class StddevIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Population", sortIndex: 2)] [InputParameter("Population", sortIndex: 2)]
public bool IsPopulation { get; set; } = false; public bool IsPopulation { get; set; } = false;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Stddev? stddev; private Stddev? stddev;
@@ -44,7 +33,7 @@ public class StddevIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
stddev = new Stddev(Periods, IsPopulation); stddev = new Stddev(Period, IsPopulation);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -57,5 +46,5 @@ public class StddevIndicator : Indicator, IWatchlistIndicator
StddevSeries!.SetValue(result.Value); StddevSeries!.SetValue(result.Value);
} }
public override string ShortName => $"StdDev ({Periods}, {(IsPopulation ? "Pop" : "Sample")}:{SourceName})"; public override string ShortName => $"StdDev ({Period}, {(IsPopulation ? "Pop" : "Sample")}:{SourceName})";
} }
+5 -16
View File
@@ -5,24 +5,13 @@ namespace QuanTAlib;
public class VarianceIndicator : Indicator, IWatchlistIndicator public class VarianceIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)] [InputParameter("Period", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Population", sortIndex: 2)] [InputParameter("Population", sortIndex: 2)]
public bool IsPopulation { get; set; } = false; public bool IsPopulation { get; set; } = false;
[InputParameter("Data source", sortIndex: 3, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Variance? variance; private Variance? variance;
@@ -44,7 +33,7 @@ public class VarianceIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
variance = new Variance(Periods, IsPopulation); variance = new Variance(Period, IsPopulation);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -57,5 +46,5 @@ public class VarianceIndicator : Indicator, IWatchlistIndicator
VarianceSeries!.SetValue(result.Value); VarianceSeries!.SetValue(result.Value);
} }
public override string ShortName => $"Variance ({Periods}, {(IsPopulation ? "Pop" : "Sample")}:{SourceName})"; public override string ShortName => $"Variance ({Period}, {(IsPopulation ? "Pop" : "Sample")}:{SourceName})";
} }
+5 -16
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class ZscoreIndicator : Indicator, IWatchlistIndicator public class ZscoreIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 2, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 2, 2000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Data source", sortIndex: 2, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Zscore? zScore; private Zscore? zScore;
@@ -41,7 +30,7 @@ public class ZscoreIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
zScore = new Zscore(Periods); zScore = new Zscore(Period);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -54,5 +43,5 @@ public class ZscoreIndicator : Indicator, IWatchlistIndicator
ZscoreSeries!.SetValue(result.Value); ZscoreSeries!.SetValue(result.Value);
} }
public override string ShortName => $"Z-Score ({Periods}:{SourceName})"; public override string ShortName => $"Z-Score ({Period}:{SourceName})";
} }
+6 -6
View File
@@ -5,15 +5,15 @@ namespace QuanTAlib;
public class AtrIndicator : Indicator, IWatchlistIndicator public class AtrIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
public bool ShowColdValues { get; set; } = true; public bool ShowColdValues { get; set; } = true;
private Atr? atr; private Atr? atr;
protected LineSeries? AtrSeries; protected LineSeries? AtrSeries;
public int MinHistoryDepths => Math.Max(5, Periods * 2); public int MinHistoryDepths => Math.Max(5, Period * 2);
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public AtrIndicator() 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."; Description = "Measures market volatility by calculating the average range between high and low prices.";
SeparateWindow = true; SeparateWindow = true;
AtrSeries = new($"ATR {Periods}", Color.Blue, 2, LineStyle.Solid); AtrSeries = new($"ATR {Period}", Color.Blue, 2, LineStyle.Solid);
AddLineSeries(AtrSeries); AddLineSeries(AtrSeries);
} }
protected override void OnInit() protected override void OnInit()
{ {
atr = new Atr(Periods); atr = new Atr(Period);
base.OnInit(); base.OnInit();
} }
@@ -42,7 +42,7 @@ public class AtrIndicator : Indicator, IWatchlistIndicator
} }
#pragma warning disable CA1416 // Validate platform compatibility #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) public override void OnPaintChart(PaintChartEventArgs args)
{ {
+7 -18
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class CmoIndicator : Indicator, IWatchlistIndicator public class CmoIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 9; public int Period { get; set; } = 9;
[InputParameter("Data source", sortIndex: 5, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
@@ -28,7 +17,7 @@ public class CmoIndicator : Indicator, IWatchlistIndicator
private Cmo? cmo; private Cmo? cmo;
protected string? SourceName; protected string? SourceName;
protected LineSeries? CmoSeries; protected LineSeries? CmoSeries;
public int MinHistoryDepths => Periods + 1; public int MinHistoryDepths => Period + 1;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; 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."; Description = "Measures the momentum of price changes using the difference between the sum of recent gains and the sum of recent losses.";
SeparateWindow = true; SeparateWindow = true;
SourceName = Source.ToString(); 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); AddLineSeries(CmoSeries);
} }
protected override void OnInit() protected override void OnInit()
{ {
cmo = new Cmo(Periods); cmo = new Cmo(Period);
base.OnInit(); base.OnInit();
} }
@@ -57,7 +46,7 @@ public class CmoIndicator : Indicator, IWatchlistIndicator
CmoSeries!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here 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 #pragma warning disable CA1416 // Validate platform compatibility
public override void OnPaintChart(PaintChartEventArgs args) public override void OnPaintChart(PaintChartEventArgs args)
+6 -6
View File
@@ -5,15 +5,15 @@ namespace QuanTAlib;
public class CviIndicator : Indicator, IWatchlistIndicator public class CviIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Show cold values", sortIndex: 21)] [InputParameter("Show cold values", sortIndex: 21)]
public bool ShowColdValues { get; set; } = true; public bool ShowColdValues { get; set; } = true;
private Cvi? cvi; private Cvi? cvi;
protected LineSeries? CviSeries; protected LineSeries? CviSeries;
public int MinHistoryDepths => Math.Max(5, Periods * 2); public int MinHistoryDepths => Math.Max(5, Period * 2);
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public CviIndicator() 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."; Description = "Measures the volatility of a financial instrument by comparing the spread between the high and low prices.";
SeparateWindow = true; SeparateWindow = true;
CviSeries = new($"CVI {Periods}", color: IndicatorExtensions.Volatility, 2, LineStyle.Solid); CviSeries = new($"CVI {Period}", color: IndicatorExtensions.Volatility, 2, LineStyle.Solid);
AddLineSeries(CviSeries); AddLineSeries(CviSeries);
} }
protected override void OnInit() protected override void OnInit()
{ {
cvi = new Cvi(Periods); cvi = new Cvi(Period);
base.OnInit(); base.OnInit();
} }
@@ -43,7 +43,7 @@ public class CviIndicator : Indicator, IWatchlistIndicator
#pragma warning disable CA1416 // Validate platform compatibility #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) public override void OnPaintChart(PaintChartEventArgs args)
{ {
+5 -5
View File
@@ -5,15 +5,15 @@ namespace QuanTAlib;
public class HistoricalIndicator : Indicator, IWatchlistIndicator public class HistoricalIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Annualized", sortIndex: 2)] [InputParameter("Annualized", sortIndex: 2)]
public bool IsAnnualized { get; set; } = true; public bool IsAnnualized { get; set; } = true;
private Hv? historical; private Hv? historical;
protected LineSeries? HvSeries; protected LineSeries? HvSeries;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public HistoricalIndicator() public HistoricalIndicator()
@@ -28,7 +28,7 @@ public class HistoricalIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
historical = new(Periods, IsAnnualized); historical = new(Period, IsAnnualized);
base.OnInit(); base.OnInit();
} }
@@ -40,5 +40,5 @@ public class HistoricalIndicator : Indicator, IWatchlistIndicator
HvSeries!.SetValue(result.Value); HvSeries!.SetValue(result.Value);
} }
public override string ShortName => $"HV ({Periods}{(IsAnnualized ? " - Annualized" : "")})"; public override string ShortName => $"HV ({Period}{(IsAnnualized ? " - Annualized" : "")})";
} }
+6 -17
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class JbandsIndicator : Indicator, IWatchlistIndicator public class JbandsIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 5, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("vShort", sortIndex: 6, -100, 100, 1, 0)] [InputParameter("vShort", sortIndex: 6, -100, 100, 1, 0)]
@@ -47,8 +36,8 @@ public class JbandsIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
jmaUp = new(Periods, phase: Phase); jmaUp = new(Period, phase: Phase);
jmaLo = new(Periods, phase: Phase); jmaLo = new(Period, phase: Phase);
SourceName = Source.ToString(); SourceName = Source.ToString();
base.OnInit(); base.OnInit();
} }
@@ -63,5 +52,5 @@ public class JbandsIndicator : Indicator, IWatchlistIndicator
LbSeries!.SetValue(jmaLo.LowerBand); LbSeries!.SetValue(jmaLo.LowerBand);
} }
public override string ShortName => $"JBands ({Periods}:{Phase})"; public override string ShortName => $"JBands ({Period}:{Phase})";
} }
+5 -16
View File
@@ -5,21 +5,10 @@ namespace QuanTAlib;
public class JvoltyIndicator : Indicator, IWatchlistIndicator public class JvoltyIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 14; public int Period { get; set; } = 14;
[InputParameter("Data source", sortIndex: 5, variants: [ [IndicatorExtensions.DataSourceInput]
"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 SourceType Source { get; set; } = SourceType.Close; public SourceType Source { get; set; } = SourceType.Close;
private Jma? jma; private Jma? jma;
@@ -41,7 +30,7 @@ public class JvoltyIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
jma = new(Periods); jma = new(Period);
base.OnInit(); base.OnInit();
} }
@@ -53,5 +42,5 @@ public class JvoltyIndicator : Indicator, IWatchlistIndicator
JvoltySeries!.SetValue(jma.Volty); JvoltySeries!.SetValue(jma.Volty);
} }
public override string ShortName => $"JVOLTY ({Periods})"; public override string ShortName => $"JVOLTY ({Period})";
} }
+5 -5
View File
@@ -5,15 +5,15 @@ namespace QuanTAlib;
public class RealizedIndicator : Indicator, IWatchlistIndicator public class RealizedIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)] [InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 20; public int Period { get; set; } = 20;
[InputParameter("Annualized", sortIndex: 2)] [InputParameter("Annualized", sortIndex: 2)]
public bool IsAnnualized { get; set; } = true; public bool IsAnnualized { get; set; } = true;
private Rv? realized; private Rv? realized;
protected LineSeries? RvSeries; protected LineSeries? RvSeries;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public RealizedIndicator() public RealizedIndicator()
@@ -28,7 +28,7 @@ public class RealizedIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
realized = new(Periods, IsAnnualized); realized = new(Period, IsAnnualized);
base.OnInit(); base.OnInit();
} }
@@ -40,5 +40,5 @@ public class RealizedIndicator : Indicator, IWatchlistIndicator
RvSeries!.SetValue(result.Value); RvSeries!.SetValue(result.Value);
} }
public override string ShortName => $"RV ({Periods}{(IsAnnualized ? " - Annualized" : "")})"; public override string ShortName => $"RV ({Period}{(IsAnnualized ? " - Annualized" : "")})";
} }
+5 -5
View File
@@ -5,12 +5,12 @@ namespace QuanTAlib;
public class RviIndicator : Indicator, IWatchlistIndicator public class RviIndicator : Indicator, IWatchlistIndicator
{ {
[InputParameter("Periods", sortIndex: 1, 2, 100, 1, 0)] [InputParameter("Period", sortIndex: 1, 2, 100, 1, 0)]
public int Periods { get; set; } = 10; public int Period { get; set; } = 10;
private Rvi? rvi; private Rvi? rvi;
protected LineSeries? RviSeries; protected LineSeries? RviSeries;
public int MinHistoryDepths => Periods; public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths; int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public RviIndicator() public RviIndicator()
@@ -25,7 +25,7 @@ public class RviIndicator : Indicator, IWatchlistIndicator
protected override void OnInit() protected override void OnInit()
{ {
rvi = new Rvi(Periods); rvi = new Rvi(Period);
base.OnInit(); base.OnInit();
} }
@@ -37,5 +37,5 @@ public class RviIndicator : Indicator, IWatchlistIndicator
RviSeries!.SetValue(result.Value); RviSeries!.SetValue(result.Value);
} }
public override string ShortName => $"RVI ({Periods})"; public override string ShortName => $"RVI ({Period})";
} }