mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-07 21:47:43 +00:00
corrections
This commit is contained in:
@@ -34,6 +34,8 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
private Afirma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
@@ -47,6 +49,7 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator
|
||||
SourceName = Source.ToString();
|
||||
Name = "AFIRMA - Adaptive Finite Impulse Response Moving Average";
|
||||
Description = "Adaptive Finite Impulse Response Moving Average with ARMA component";
|
||||
|
||||
Series = new(name: $"AFIRMA {Taps}:{Periods}:{Window}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
|
||||
AddLineSeries(Series);
|
||||
}
|
||||
@@ -63,9 +66,17 @@ public class AfirmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue input = this.GetInputValue(args, Source);
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
Series!.SetValue(result.Value);
|
||||
}
|
||||
|
||||
public override string ShortName => $"AFIRMA {Taps}:{Periods}:{Window}:{SourceName}";
|
||||
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ public class AlmaIndicator : Indicator, IWatchlistIndicator
|
||||
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
|
||||
public int Period { get; set; } = 10;
|
||||
|
||||
[InputParameter("Offset", sortIndex: 2)]
|
||||
[InputParameter("Offset", sortIndex: 2, minimum: 0, maximum: 1, decimalPlaces: 2)]
|
||||
public double Offset { get; set; } = 0.85;
|
||||
|
||||
[InputParameter("Sigma", sortIndex: 3)]
|
||||
[InputParameter("Sigma", sortIndex: 3, minimum: 0, maximum: 100, decimalPlaces: 1)]
|
||||
public double Sigma { get; set; } = 6.0;
|
||||
|
||||
[InputParameter("Data source", sortIndex: 4, variants: [
|
||||
@@ -28,12 +28,17 @@ public class AlmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Alma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Period;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"ALMA {Period}:{Offset:F2}:{Sigma:F1}:{SourceName}";
|
||||
|
||||
public AlmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -58,7 +63,13 @@ public class AlmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"ALMA {Period}:{Offset:F2}:{Sigma:F0}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class DemaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Dema? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Period;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"DEMA {Period}:{SourceName}";
|
||||
|
||||
public DemaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class DemaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"DEMA {Period}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,17 @@ public class DsmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Dsma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths { get; private set; }
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"DSMA {Period}:{Scale:F2}:{SourceName}";
|
||||
|
||||
public DsmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -56,8 +61,13 @@ public class DsmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"DSMA {Period}:{Scale:F2}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,17 @@ public class DwmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Dwma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Period;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"DWMA {Period}:{SourceName}";
|
||||
|
||||
public DwmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,8 +57,13 @@ public class DwmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"DWMA {Period}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,11 @@ namespace QuanTAlib;
|
||||
public class EmaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 14;
|
||||
public int Periods { get; set; } = 10;
|
||||
[InputParameter("Use SMA for warmup period", sortIndex: 2)]
|
||||
public bool UseSMA { get; set; } = false;
|
||||
|
||||
[InputParameter("Data source", sortIndex: 2, variants: [
|
||||
[InputParameter("Data source", sortIndex: 3, variants: [
|
||||
"Open", SourceType.Open,
|
||||
"High", SourceType.High,
|
||||
"Low", SourceType.Low,
|
||||
@@ -22,12 +24,17 @@ public class EmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Ema? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"EMA {Periods}:{SourceName}";
|
||||
|
||||
public EmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -41,7 +48,7 @@ public class EmaIndicator : Indicator, IWatchlistIndicator
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
ma = new Ema(Periods);
|
||||
ma = new Ema(Periods, useSma: UseSMA);
|
||||
SourceName = Source.ToString();
|
||||
base.OnInit();
|
||||
}
|
||||
@@ -52,7 +59,13 @@ public class EmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"EMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace QuanTAlib;
|
||||
public class EpmaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 14;
|
||||
public int Periods { get; set; } = 10;
|
||||
|
||||
[InputParameter("Data source", sortIndex: 2, variants: [
|
||||
"Open", SourceType.Open,
|
||||
@@ -22,12 +22,17 @@ public class EpmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Epma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"EPMA {Periods}:{SourceName}";
|
||||
|
||||
public EpmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class EpmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"EPMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace QuanTAlib;
|
||||
public class FramaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 14;
|
||||
public int Periods { get; set; } = 10;
|
||||
|
||||
[InputParameter("Data source", sortIndex: 2, variants: [
|
||||
"Open", SourceType.Open,
|
||||
@@ -22,12 +22,17 @@ public class FramaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Frama? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods * 2;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"FRAMA {Periods}:{SourceName}";
|
||||
|
||||
public FramaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class FramaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"FRAMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace QuanTAlib;
|
||||
public class FwmaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 14;
|
||||
public int Periods { get; set; } = 10;
|
||||
|
||||
[InputParameter("Data source", sortIndex: 2, variants: [
|
||||
"Open", SourceType.Open,
|
||||
@@ -22,12 +22,17 @@ public class FwmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Fwma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"FWMA {Periods}:{SourceName}";
|
||||
|
||||
public FwmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class FwmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"FWMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,7 @@ namespace QuanTAlib;
|
||||
public class GmaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 14;
|
||||
|
||||
[InputParameter("Sigma", sortIndex: 2, 0.1, 10, 0.1, 1)]
|
||||
public double Sigma { get; set; } = 1.0;
|
||||
public int Periods { get; set; } = 10;
|
||||
|
||||
[InputParameter("Data source", sortIndex: 3, variants: [
|
||||
"Open", SourceType.Open,
|
||||
@@ -25,12 +22,17 @@ public class GmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Gma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"GMA {Periods}:{SourceName}";
|
||||
|
||||
public GmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -55,7 +57,13 @@ public class GmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"GMA {Periods}:{Sigma}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace QuanTAlib;
|
||||
public class HmaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 14;
|
||||
public int Periods { get; set; } = 10;
|
||||
|
||||
[InputParameter("Data source", sortIndex: 2, variants: [
|
||||
"Open", SourceType.Open,
|
||||
@@ -22,12 +22,17 @@ public class HmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Hma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods + (int)Math.Sqrt(Periods) - 1;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"HMA {Periods}:{SourceName}";
|
||||
|
||||
public HmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class HmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"HMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,12 +19,17 @@ public class HtitIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Htit? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 12; // Based on WarmupPeriod in Htit
|
||||
public static int MinHistoryDepths => 12; // Based on WarmupPeriod in Htit
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"HTIT:{SourceName}";
|
||||
|
||||
public HtitIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -49,7 +54,13 @@ public class HtitIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"HTIT:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace QuanTAlib;
|
||||
|
||||
public class HwmaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 14;
|
||||
[InputParameter("Periods (only when nA=nB=nC=0)", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 10;
|
||||
|
||||
[InputParameter("nA", sortIndex: 2, 0, 1, 0.01, 2)]
|
||||
public double NA { get; set; } = 0;
|
||||
@@ -31,12 +31,17 @@ public class HwmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Hwma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"HWMA {Periods}:{NA}:{NB}:{NC}:{SourceName}";
|
||||
|
||||
public HwmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -68,7 +73,13 @@ public class HwmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"HWMA {Periods}:{NA}:{NB}:{NC}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,11 @@ namespace QuanTAlib;
|
||||
public class JmaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 14;
|
||||
public int Periods { get; set; } = 10;
|
||||
|
||||
[InputParameter("Phase", sortIndex: 2, -100, 100, 1, 0)]
|
||||
public double Phase { get; set; } = 0;
|
||||
|
||||
[InputParameter("VShort", sortIndex: 3, 1, 100, 1, 0)]
|
||||
public int VShort { get; set; } = 10;
|
||||
|
||||
[InputParameter("Data source", sortIndex: 4, variants: [
|
||||
"Open", SourceType.Open,
|
||||
"High", SourceType.High,
|
||||
@@ -28,12 +25,17 @@ public class JmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Jma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods * 2;
|
||||
public int MinHistoryDepths => Math.Max(65,Periods * 2);
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"JMA {Periods}:{Phase}:{SourceName}";
|
||||
|
||||
public JmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -47,7 +49,7 @@ public class JmaIndicator : Indicator, IWatchlistIndicator
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
ma = new Jma(Periods, Phase, VShort);
|
||||
ma = new Jma(Periods, Phase);
|
||||
SourceName = Source.ToString();
|
||||
base.OnInit();
|
||||
}
|
||||
@@ -58,7 +60,13 @@ public class JmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"JMA {Periods}:{Phase}:{VShort}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace QuanTAlib;
|
||||
public class KamaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 14;
|
||||
public int Periods { get; set; } = 10;
|
||||
|
||||
[InputParameter("Fast", sortIndex: 2, 1, 100, 1, 0)]
|
||||
public int Fast { get; set; } = 2;
|
||||
@@ -28,12 +28,17 @@ public class KamaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Kama? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"KAMA {Periods}:{Fast}:{Slow}:{SourceName}";
|
||||
|
||||
public KamaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -58,7 +63,13 @@ public class KamaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"KAMA {Periods}:{Fast}:{Slow}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class LtmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Ltma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 4; // Based on WarmupPeriod in Ltma
|
||||
public static int MinHistoryDepths => 4; // Based on WarmupPeriod in Ltma
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"LTMA {Gamma}:{SourceName}";
|
||||
|
||||
public LtmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class LtmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"LTMA {Gamma}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace QuanTAlib;
|
||||
public class MaafIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 3, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 39;
|
||||
public int Periods { get; set; } = 10;
|
||||
|
||||
[InputParameter("Threshold", sortIndex: 2, 0.0001, 0.1, 0.0001, 4)]
|
||||
public double Threshold { get; set; } = 0.002;
|
||||
@@ -25,12 +25,17 @@ public class MaafIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Maaf? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"MAAF {Periods}:{Threshold}:{SourceName}";
|
||||
|
||||
public MaafIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -55,7 +60,13 @@ public class MaafIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"MAAF {Periods}:{Threshold}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,13 +25,18 @@ public class MamaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Mama? ma;
|
||||
protected LineSeries? MamaSeries;
|
||||
protected LineSeries? FamaSeries;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 6;
|
||||
public static int MinHistoryDepths => 6;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"MAMA {FastLimit}:{SlowLimit}:{SourceName}";
|
||||
|
||||
public MamaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -58,8 +63,16 @@ public class MamaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
MamaSeries!.SetValue(result.Value);
|
||||
MamaSeries!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
FamaSeries!.SetValue(ma.Fama.Value);
|
||||
FamaSeries!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"MAMA {FastLimit}:{SlowLimit}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, MamaSeries!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.PaintSmoothCurve(args, FamaSeries!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,17 @@ public class MgdiIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Mgdi? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"MGDI {Periods}:{KFactor}:{SourceName}";
|
||||
|
||||
public MgdiIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -55,7 +60,13 @@ public class MgdiIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"MGDI {Periods}:{KFactor}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class MmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Mma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"MMA {Periods}:{SourceName}";
|
||||
|
||||
public MmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class MmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"MMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class PwmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Pwma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"PWMA {Periods}:{SourceName}";
|
||||
|
||||
public PwmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class PwmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"PWMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,12 +31,17 @@ public class QemaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Qema? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => (int)((2 - Math.Min(Math.Min(K1, K2), Math.Min(K3, K4))) / Math.Min(Math.Min(K1, K2), Math.Min(K3, K4)));
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"QEMA {K1},{K2},{K3},{K4}:{SourceName}";
|
||||
|
||||
public QemaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -61,7 +66,13 @@ public class QemaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"QEMA {K1},{K2},{K3},{K4}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,17 @@ public class RemaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Rema? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"REMA {Periods}:{Lambda}:{SourceName}";
|
||||
|
||||
public RemaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -55,7 +60,13 @@ public class RemaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"REMA {Periods}:{Lambda}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class RmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Rma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods * 2;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"RMA {Periods}:{SourceName}";
|
||||
|
||||
public RmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class RmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"RMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class SinemaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Sinema? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"SINEMA {Periods}:{SourceName}";
|
||||
|
||||
public SinemaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class SinemaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"SINEMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace QuanTAlib;
|
||||
public class SmaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 14;
|
||||
public int Period { get; set; } = 14;
|
||||
|
||||
[InputParameter("Data source", sortIndex: 2, variants: [
|
||||
"Open", SourceType.Open,
|
||||
@@ -22,10 +22,14 @@ public class SmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Sma? ma;
|
||||
private Mape? error;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
public int MinHistoryDepths => Period;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public SmaIndicator()
|
||||
@@ -35,13 +39,14 @@ public class SmaIndicator : Indicator, IWatchlistIndicator
|
||||
SourceName = Source.ToString();
|
||||
Name = "SMA - Simple Moving Average";
|
||||
Description = "Simple Moving Average";
|
||||
Series = new(name: $"SMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
|
||||
Series = new(name: $"SMA {Period}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
|
||||
AddLineSeries(Series);
|
||||
}
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
ma = new Sma(Periods);
|
||||
ma = new Sma(Period);
|
||||
error = new(Period);
|
||||
SourceName = Source.ToString();
|
||||
base.OnInit();
|
||||
}
|
||||
@@ -50,9 +55,18 @@ public class SmaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
TValue input = this.GetInputValue(args, Source);
|
||||
TValue result = ma!.Calc(input);
|
||||
error!.Calc(input, result);
|
||||
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
Series!.SetValue(result.Value);
|
||||
}
|
||||
|
||||
public override string ShortName => $"SMA {Periods}:{SourceName}";
|
||||
public override string ShortName => $"SMA {Period}:{SourceName}";
|
||||
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, error!.Value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class SmmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Smma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"SMMA {Periods}:{SourceName}";
|
||||
|
||||
public SmmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class SmmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"SMMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,17 @@ public class T3Indicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private T3? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"T3 {Periods}:{VolumeFactor}:{UseSma}:{SourceName}";
|
||||
|
||||
public T3Indicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -58,7 +63,13 @@ public class T3Indicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"T3 {Periods}:{VolumeFactor}:{UseSma}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class TemaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Tema? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => (int)Math.Ceiling(-Periods * Math.Log(1 - 0.85));
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"TEMA {Periods}:{SourceName}";
|
||||
|
||||
public TemaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class TemaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"TEMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class TrimaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Trima? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"TRIMA {Periods}:{SourceName}";
|
||||
|
||||
public TrimaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class TrimaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"TRIMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,12 +28,17 @@ public class VidyaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Vidya? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => LongPeriod == 0 ? ShortPeriod * 4 : LongPeriod;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"VIDYA {ShortPeriod}:{LongPeriod}:{Alpha}:{SourceName}";
|
||||
|
||||
public VidyaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -58,7 +63,13 @@ public class VidyaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"VIDYA {ShortPeriod}:{LongPeriod}:{Alpha}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,17 @@ public class WmaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Wma? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"WMA {Periods}:{SourceName}";
|
||||
|
||||
public WmaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -52,7 +57,13 @@ public class WmaIndicator : Indicator, IWatchlistIndicator
|
||||
TValue result = ma!.Calc(input);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"WMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,18 @@ public class ZlemaIndicator : Indicator, IWatchlistIndicator
|
||||
])]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
|
||||
private Zlema? ma;
|
||||
private Huberloss? err;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"ZLEMA {Periods}:{SourceName}";
|
||||
|
||||
public ZlemaIndicator()
|
||||
{
|
||||
OnBackGround = true;
|
||||
@@ -41,7 +47,8 @@ public class ZlemaIndicator : Indicator, IWatchlistIndicator
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
ma = new Zlema(Periods);
|
||||
ma = new(Periods);
|
||||
err = new(Periods);
|
||||
SourceName = Source.ToString();
|
||||
base.OnInit();
|
||||
}
|
||||
@@ -50,9 +57,16 @@ public class ZlemaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
TValue input = this.GetInputValue(args, Source);
|
||||
TValue result = ma!.Calc(input);
|
||||
err!.Calc(input, result);
|
||||
|
||||
Series!.SetValue(result.Value);
|
||||
Series!.SetMarker(0, Color.Transparent); //OnPaintChart draws the line, hidden here
|
||||
}
|
||||
|
||||
public override string ShortName => $"ZLEMA {Periods}:{SourceName}";
|
||||
public override void OnPaintChart(PaintChartEventArgs args)
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
this.PaintSmoothCurve(args, Series!, ma!.WarmupPeriod, showColdValues: ShowColdValues, tension: 0.2);
|
||||
this.DrawText(args, err!.Value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,6 @@ public static class IndicatorExtensions
|
||||
|
||||
if (allPoints.Count > 1)
|
||||
{
|
||||
|
||||
if (allPoints.Count < 2) return;
|
||||
|
||||
using (Pen defaultPen = new(series.Color, series.Width) { DashStyle = ConvertLineStyleToDashStyle(series.Style) })
|
||||
@@ -140,7 +139,6 @@ public static class IndicatorExtensions
|
||||
_ => DashStyle.Solid,
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class EntropyIndicator : Indicator, IWatchlistIndicator
|
||||
private Entropy? entropy;
|
||||
protected LineSeries? EntropySeries;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 2;
|
||||
public static int MinHistoryDepths => 2;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public EntropyIndicator()
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MaxIndicator : Indicator, IWatchlistIndicator
|
||||
private Max? ma;
|
||||
protected LineSeries? MaxSeries;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 0;
|
||||
public static int MinHistoryDepths => 0;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public MaxIndicator()
|
||||
|
||||
@@ -28,7 +28,7 @@ public class MinIndicator : Indicator, IWatchlistIndicator
|
||||
private Min? mi;
|
||||
protected LineSeries? MinSeries;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 0;
|
||||
public static int MinHistoryDepths => 0;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public MinIndicator()
|
||||
|
||||
@@ -28,7 +28,7 @@ public class PercentileIndicator : Indicator, IWatchlistIndicator
|
||||
private Percentile? percentile;
|
||||
protected LineSeries? PercentileSeries;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 2;
|
||||
public static int MinHistoryDepths => 2;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public PercentileIndicator()
|
||||
|
||||
@@ -25,7 +25,7 @@ public class SkewIndicator : Indicator, IWatchlistIndicator
|
||||
private Skew? skew;
|
||||
protected LineSeries? SkewSeries;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 3;
|
||||
public static int MinHistoryDepths => 3;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public SkewIndicator()
|
||||
|
||||
@@ -28,7 +28,7 @@ public class StddevIndicator : Indicator, IWatchlistIndicator
|
||||
private Stddev? stddev;
|
||||
protected LineSeries? StddevSeries;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 2;
|
||||
public static int MinHistoryDepths => 2;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public StddevIndicator()
|
||||
|
||||
@@ -28,7 +28,7 @@ public class VarianceIndicator : Indicator, IWatchlistIndicator
|
||||
private Variance? variance;
|
||||
protected LineSeries? VarianceSeries;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 2;
|
||||
public static int MinHistoryDepths => 2;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public VarianceIndicator()
|
||||
|
||||
@@ -25,7 +25,7 @@ public class ZscoreIndicator : Indicator, IWatchlistIndicator
|
||||
private Zscore? zScore;
|
||||
protected LineSeries? ZscoreSeries;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => 2;
|
||||
public static int MinHistoryDepths => 2;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public ZscoreIndicator()
|
||||
|
||||
@@ -10,7 +10,7 @@ public class AtrIndicator : Indicator, IWatchlistIndicator
|
||||
|
||||
private Atr? atr;
|
||||
protected LineSeries? AtrSeries;
|
||||
public int MinHistoryDepths => 2;
|
||||
public static int MinHistoryDepths => 2;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public AtrIndicator()
|
||||
|
||||
@@ -27,7 +27,6 @@ public class TestIndicator : Indicator, IWatchlistIndicator
|
||||
|
||||
private Sma? ma;
|
||||
protected LineSeries? Series;
|
||||
//protected string? SourceName;
|
||||
public int MinHistoryDepths { get; set; }
|
||||
int IWatchlistIndicator.MinHistoryDepths => 0; //QuanTAlib indicators generate value immediately
|
||||
|
||||
|
||||
Reference in New Issue
Block a user