refresh with new QT DLL

This commit is contained in:
Miha Kralj
2024-10-12 20:36:37 -07:00
parent cc45cebeb4
commit b3b3b24a25
65 changed files with 2593 additions and 1189 deletions
+43 -9
View File
@@ -1,7 +1,9 @@
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class AfirmaIndicator : IndicatorBase
public class AfirmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Taps (number of weights)", sortIndex: 1, 1, 2000, 1, 0)]
public int Taps { get; set; } = 6;
@@ -11,27 +13,59 @@ public class AfirmaIndicator : IndicatorBase
[InputParameter("Window Type", sortIndex: 3, variants: [
"Rectangular", Afirma.WindowType.Rectangular,
"Hanning", Afirma.WindowType.Hanning1,
"Hamming", Afirma.WindowType.Hanning2,
"Blackman", Afirma.WindowType.Blackman,
"Blackman-Harris", Afirma.WindowType.BlackmanHarris
"Hanning", Afirma.WindowType.Hanning1,
"Hamming", Afirma.WindowType.Hanning2,
"Blackman", Afirma.WindowType.Blackman,
"Blackman-Harris", Afirma.WindowType.BlackmanHarris
])]
public Afirma.WindowType Window { get; set; } = Afirma.WindowType.Hanning1;
[InputParameter("Data source", sortIndex: 4, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Afirma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"AFIRMA {Taps}:{Periods}:{Window} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods + Taps;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public AfirmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
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);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Afirma(periods: Periods, taps: Taps, window: Window);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"AFIRMA {Taps}:{Periods}:{Window}:{SourceName}";
}
+45 -11
View File
@@ -1,30 +1,64 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class AlmaIndicator : IndicatorBase
public class AlmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Offset", sortIndex: 5)]
[InputParameter("Offset", sortIndex: 2)]
public double Offset { get; set; } = 0.85;
[InputParameter("Sigma", sortIndex: 6)]
[InputParameter("Sigma", sortIndex: 3)]
public double Sigma { get; set; } = 6.0;
private Alma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"ALMA {Period} : {Offset:F2} : {Sigma:F0} : {SourceName}";
public AlmaIndicator() : base()
[InputParameter("Data source", sortIndex: 4, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Alma? ma;
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public AlmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "ALMA - Arnaud Legoux Moving Average";
Description = "Arnaud Legoux Moving Average";
Series = new(name: $"ALMA {Period}:{Offset:F2}:{Sigma:F0}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Alma(period: Period, offset: Offset, sigma: Sigma);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"ALMA {Period}:{Offset:F2}:{Sigma:F0}:{SourceName}";
}
+43 -8
View File
@@ -1,23 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class DemaIndicator : IndicatorBase
public class DemaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
private Dema? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"DEMA {Period} : {SourceName}";
public DemaIndicator() : base()
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Dema? ma;
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public DemaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "DEMA - Double Exponential Moving Average";
Description = "A faster-responding moving average that reduces lag by applying the EMA twice.";
Series = new(name: $"DEMA {Period}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Dema(period: Period);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"DEMA {Period}:{SourceName}";
}
+44 -8
View File
@@ -1,27 +1,63 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class DsmaIndicator : IndicatorBase
public class DsmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Scale factor", sortIndex: 2, minimum: 0.01, maximum: 1.0, increment: 0.01, decimalPlaces: 2)]
public double Scale { get; set; } = 0.5;
private Dsma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"DSMA {Period} : {Scale:F2} : {SourceName}";
[InputParameter("Data source", sortIndex: 3, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
public DsmaIndicator() : base()
private Dsma? ma;
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths { get; private set; }
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public DsmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "DSMA - Deviation Scaled Moving Average";
Description = "A moving average that adjusts its responsiveness based on price deviations from the mean.";
Series = new(name: $"DSMA {Period}:{Scale:F2}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Dsma(Period, Scale);
MinHistoryDepths = ma.WarmupPeriod;
base.InitIndicator();
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"DSMA {Period}:{Scale:F2}:{SourceName}";
}
+43 -8
View File
@@ -1,24 +1,59 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class DwmaIndicator : IndicatorBase
public class DwmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
private Dwma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"DWMA {Period} : {SourceName}";
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
public DwmaIndicator() : base()
private Dwma? ma;
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Period;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public DwmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "DWMA - Double Weighted Moving Average";
Description = "A moving average that applies double weighting to recent prices for increased responsiveness.";
Series = new(name: $"DWMA {Period}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Dwma(Period);
base.InitIndicator();
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"DWMA {Period}:{SourceName}";
}
+44 -13
View File
@@ -1,27 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class EmaIndicator : IndicatorBase
public class EmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Use SMA for warmup", sortIndex: 5)]
public bool UseSma { get; set; } = false;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Ema? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"EMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public EmaIndicator() : base()
public EmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "EMA - Exponential Moving Average";
Description = "Moving average that gives more weight to recent prices, reducing lag in trend following.";
Description = "Exponential Moving Average";
Series = new(name: $"EMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Ema(period: Period, useSma: UseSma);
ma = new Ema(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"EMA {Periods}:{SourceName}";
}
+46 -12
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class EpmaIndicator : IndicatorBase
public class EpmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Epma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"EPMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public EpmaIndicator() : base()
public EpmaIndicator()
{
Name = "EPMA - Endpoint Moving Average";
Description = "Moving average that emphasizes the most recent data point, useful for identifying trend changes.";
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "EPMA - Exponential Percentage Moving Average";
Description = "Exponential Percentage Moving Average";
Series = new(name: $"EPMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Epma(period: Period);
ma = new Epma(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"EPMA {Periods}:{SourceName}";
}
+45 -11
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class FramaIndicator : IndicatorBase
public class FramaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Frama? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"FRAMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods * 2;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public FramaIndicator() : base()
public FramaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "FRAMA - Fractal Adaptive Moving Average";
Description = "Adaptive moving average that adjusts its smoothing based on market fractal dimension.";
Description = "Fractal Adaptive Moving Average";
Series = new(name: $"FRAMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Frama(Period);
base.InitIndicator();
ma = new Frama(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"FRAMA {Periods}:{SourceName}";
}
+46 -12
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class FwmaIndicator : IndicatorBase
public class FwmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Fwma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"FWMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public FwmaIndicator() : base()
public FwmaIndicator()
{
Name = "FWMA - Fibonacci-Weighted Moving Average";
Description = "Moving average that uses Fibonacci sequence for weighting, emphasizing recent and key historical prices.";
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "FWMA - Fibonacci Weighted Moving Average";
Description = "Fibonacci Weighted Moving Average";
Series = new(name: $"FWMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Fwma(Period);
base.InitIndicator();
ma = new Fwma(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"FWMA {Periods}:{SourceName}";
}
+49 -12
View File
@@ -1,24 +1,61 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class GmaIndicator : IndicatorBase
public class GmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[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;
[InputParameter("Data source", sortIndex: 3, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Gma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"GMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public GmaIndicator() : base()
public GmaIndicator()
{
Name = "GMA - Gaussian-Weighted Moving Average";
Description = "Moving average using Gaussian distribution for weighting, balancing recent and historical data.";
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "GMA - Gaussian Moving Average";
Description = "Gaussian Moving Average";
Series = new(name: $"GMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Gma(Period);
base.InitIndicator();
ma = new Gma(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"GMA {Periods}:{Sigma}:{SourceName}";
}
+45 -11
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class HmaIndicator : IndicatorBase
public class HmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Hma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"HMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods + (int)Math.Sqrt(Periods) - 1;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public HmaIndicator() : base()
public HmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "HMA - Hull Moving Average";
Description = "Responsive moving average that reduces lag while maintaining smoothness in price action.";
Description = "Hull Moving Average";
Series = new(name: $"HMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Hma(Period);
base.InitIndicator();
ma = new Hma(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"HMA {Periods}:{SourceName}";
}
+43 -10
View File
@@ -1,22 +1,55 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class HtitIndicator : IndicatorBase
public class HtitIndicator : Indicator, IWatchlistIndicator
{
private Htit? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"HTIT : {SourceName}";
[InputParameter("Data source", sortIndex: 1, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
public HtitIndicator() : base()
private Htit? ma;
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => 12; // Based on WarmupPeriod in Htit
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public HtitIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "HTIT - Hilbert Transform Instantaneous Trendline";
Description = "Uses Hilbert Transform to identify the dominant cycle and generate a smooth, lag-free trendline.";
Description = "Hilbert Transform Instantaneous Trendline (Note: This indicator may not be fully functional)";
Series = new(name: "HTIT", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Htit();
MinHistoryDepths = ma.WarmupPeriod;
base.InitIndicator();
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"HTIT:{SourceName}";
}
+59 -15
View File
@@ -1,30 +1,74 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class HwmaIndicator : IndicatorBase
public class HwmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("nA - smoothed series", sortIndex: 5, minimum: 0.0, maximum: 1.0, increment: 0.1, decimalPlaces: 2)]
public double nA { get; set; } = 0.18;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("nB - assess the trend (from 0 to 1)", sortIndex: 6, minimum: 0.0, maximum: 1.0, increment: 0.1, decimalPlaces: 2)]
public double nB { get; set; } = 0.1;
[InputParameter("nA", sortIndex: 2, 0, 1, 0.01, 2)]
public double NA { get; set; } = 0;
[InputParameter("nC - assess seasonality (from 0 to 1)", sortIndex: 7, minimum: 0.0, maximum: 1.0, increment: 0.1, decimalPlaces: 2)]
public double nC { get; set; } = 0.1;
[InputParameter("nB", sortIndex: 3, 0, 1, 0.01, 2)]
public double NB { get; set; } = 0;
[InputParameter("nC", sortIndex: 4, 0, 1, 0.01, 2)]
public double NC { get; set; } = 0;
[InputParameter("Data source", sortIndex: 5, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Hwma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"HWMA {nA:F2} : {nB:F2} : {nC:F2} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public HwmaIndicator() : base()
public HwmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "HWMA - Holt-Winter Moving Average";
Description = "Triple exponential moving average that accounts for level, trend, and seasonal components.";
Description = "Holt-Winter Moving Average";
Series = new(name: $"HWMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Hwma(nA: nA, nB: nB, nC: nC);
base.InitIndicator();
if (NA == 0 && NB == 0 && NC == 0)
{
ma = new Hwma(Periods);
}
else
{
ma = new Hwma(Periods, NA, NB, NC);
}
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"HWMA {Periods}:{NA}:{NB}:{NC}:{SourceName}";
}
+50 -12
View File
@@ -1,26 +1,64 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class JmaIndicator : IndicatorBase
public class JmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 2, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Phase", sortIndex: 2, -100, 100, 1, 0)]
public int Phase { get; set; } = 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,
"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;
private Jma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"JMA {Period} : {Phase} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods * 2;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public JmaIndicator() : base()
public JmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "JMA - Jurik Moving Average";
Description = "Adaptive moving average with reduced lag and noise, adjustable smoothness and phase shift.";
Description = "Jurik Moving Average (Note: This indicator may have consistency issues)";
Series = new(name: $"JMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Jma(period: Period, phase: (double)Phase);
base.InitIndicator();
ma = new Jma(Periods, Phase, VShort);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"JMA {Periods}:{Phase}:{VShort}:{SourceName}";
}
+49 -13
View File
@@ -1,28 +1,64 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class KamaIndicator : IndicatorBase
public class KamaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Fast", sortIndex: 2, 1, 2000, 1, 0)]
[InputParameter("Fast", sortIndex: 2, 1, 100, 1, 0)]
public int Fast { get; set; } = 2;
[InputParameter("Slow", sortIndex: 3, 1, 2000, 1, 0)]
[InputParameter("Slow", sortIndex: 3, 1, 100, 1, 0)]
public int Slow { get; set; } = 30;
[InputParameter("Data source", sortIndex: 4, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Kama? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"KAMA {Period} : {Fast} : {Slow} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public KamaIndicator() : base()
public KamaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "KAMA - Kaufman's Adaptive Moving Average";
Description = "Adaptive moving average that adjusts to market volatility, reducing lag in trending markets.";
Description = "Kaufman's Adaptive Moving Average";
Series = new(name: $"KAMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Kama(Period, Fast, Slow);
base.InitIndicator();
ma = new Kama(Periods, Fast, Slow);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"KAMA {Periods}:{Fast}:{Slow}:{SourceName}";
}
+46 -12
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class LtmaIndicator : IndicatorBase
public class LtmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Gamma", sortIndex: 1, 0, 1, 0.01, 2)]
public double Gamma { get; set; } = 0.10;
[InputParameter("Gamma", sortIndex: 1, 0.01, 1, 0.01, 2)]
public double Gamma { get; set; } = 0.1;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Ltma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"Laguerre {Gamma:F2} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => 4; // Based on WarmupPeriod in Ltma
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public LtmaIndicator() : base()
public LtmaIndicator()
{
Name = "LTMA - Laguerre Transform Moving Average";
Description = "Moving average using Laguerre polynomials, offering adjustable smoothing and lag reduction.";
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "LTMA - Laguerre Time Moving Average";
Description = "Laguerre Time Moving Average";
Series = new(name: $"LTMA {Gamma}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Ltma(gamma: Gamma);
base.InitIndicator();
ma = new Ltma(Gamma);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"LTMA {Gamma}:{SourceName}";
}
+48 -14
View File
@@ -1,27 +1,61 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class MaafIndicator : IndicatorBase
public class MaafIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 39;
[InputParameter("Periods", sortIndex: 1, 3, 1000, 1, 0)]
public int Periods { get; set; } = 39;
[InputParameter("Threshold", sortIndex: 5, minimum: 0, maximum: 1, increment: 0.001, decimalPlaces: 3)]
private double Threshold { get; set; } = 0.002;
[InputParameter("Threshold", sortIndex: 2, 0.0001, 0.1, 0.0001, 4)]
public double Threshold { get; set; } = 0.002;
[InputParameter("Data source", sortIndex: 3, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Maaf? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"MAAF {Period} : {Threshold:F2} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public MaafIndicator() : base()
public MaafIndicator()
{
Name = "MAAF - Median-Average Adaptive Filter";
Description = "Adaptive filter combining median and average, reducing noise while preserving trend responsiveness.";
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "MAAF - Median Adaptive Averaging Filter";
Description = "Median Adaptive Averaging Filter (Note: This indicator may have consistency issues)";
Series = new(name: $"MAAF {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Maaf(period: Period, threshold: Threshold);
ma = new Maaf(Periods, Threshold);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"MAAF {Periods}:{Threshold}:{SourceName}";
}
+53 -13
View File
@@ -1,25 +1,65 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class MamaIndicator : IndicatorBase
public class MamaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Fast limit", sortIndex: 2, 0, 1, 0.01, 2)]
public double Fast { get; set; } = 0.4;
[InputParameter("Slow limit", sortIndex: 3, 0, 1, 0.01, 2)]
public double Slow { get; set; } = 0.04;
[InputParameter("Fast Limit", sortIndex: 1, 0.01, 1, 0.01, 2)]
public double FastLimit { get; set; } = 0.5;
[InputParameter("Slow Limit", sortIndex: 2, 0.01, 1, 0.01, 2)]
public double SlowLimit { get; set; } = 0.05;
[InputParameter("Data source", sortIndex: 3, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Mama? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"MAMA : {Fast} : {Slow} : {SourceName}";
protected LineSeries? MamaSeries;
protected LineSeries? FamaSeries;
protected string? SourceName;
public int MinHistoryDepths => 6;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public MamaIndicator() : base()
public MamaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "MAMA - MESA Adaptive Moving Average";
Description = "Adaptive moving average using MESA algorithm to adjust to market cycles and reduce lag.";
Description = "MESA Adaptive Moving Average";
MamaSeries = new(name: "MAMA", color: Color.Yellow, width: 2, style: LineStyle.Solid);
FamaSeries = new(name: "FAMA", color: Color.Red, width: 2, style: LineStyle.Solid);
AddLineSeries(MamaSeries);
AddLineSeries(FamaSeries);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Mama(Fast, Slow);
base.InitIndicator();
ma = new Mama(FastLimit, SlowLimit);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
MamaSeries!.SetValue(result.Value);
FamaSeries!.SetValue(ma.Fama.Value);
}
public override string ShortName => $"MAMA {FastLimit}:{SlowLimit}:{SourceName}";
}
+48 -14
View File
@@ -1,27 +1,61 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class MgdiIndicator : IndicatorBase
public class MgdiIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("k Factor", sortIndex: 2, minimum: 0.0, maximum: 1.0, increment: 0.1, decimalPlaces: 2)]
public double kfactor { get; set; } = 0.6;
[InputParameter("K-Factor", sortIndex: 2, 0.1, 2, 0.1, 1)]
public double KFactor { get; set; } = 0.6;
[InputParameter("Data source", sortIndex: 3, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Mgdi? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"MGDI {Period} : {kfactor:F2} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public MgdiIndicator() : base()
public MgdiIndicator()
{
Name = "MGDI - McGinley Dynamic Index";
Description = "Adaptive moving average that adjusts to market speed, reducing whipsaws in trending markets.";
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "MGDI - McGinley Dynamic Indicator";
Description = "McGinley Dynamic Indicator";
Series = new(name: $"MGDI {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Mgdi(period: Period, kFactor: kfactor);
base.InitIndicator();
ma = new Mgdi(Periods, KFactor);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"MGDI {Periods}:{KFactor}:{SourceName}";
}
+45 -11
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class MmaIndicator : IndicatorBase
public class MmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 2, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Mma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"MMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public MmaIndicator() : base()
public MmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "MMA - Modified Moving Average";
Description = "Variation of EMA that reduces lag and smooths price action, balancing responsiveness and stability.";
Description = "Modified Moving Average";
Series = new(name: $"MMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Mma(period: Period);
ma = new Mma(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"MMA {Periods}:{SourceName}";
}
+44 -10
View File
@@ -1,24 +1,58 @@
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class PwmaIndicator : IndicatorBase
public class PwmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Pwma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"PWMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public PwmaIndicator() : base()
public PwmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "PWMA - Pascal's Weighted Moving Average";
Description = "Moving average using Pascal's triangle coefficients, emphasizing recent data with smooth transitions.";
Description = "Pascal's Weighted Moving Average";
Series = new(name: $"PWMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Pwma(period: Period);
ma = new Pwma(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"PWMA {Periods}:{SourceName}";
}
+55 -18
View File
@@ -1,30 +1,67 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class QemaIndicator : IndicatorBase
public class QemaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("alpha 1", sortIndex: 1, minimum: 0.01, maximum: 1.0, increment: 0.01, decimalPlaces: 2)]
public double k1 { get; set; } = 0.2;
[InputParameter("K1", sortIndex: 1, 0.01, 1, 0.01, 2)]
public double K1 { get; set; } = 0.2;
[InputParameter("K2", sortIndex: 2, 0.01, 1, 0.01, 2)]
public double K2 { get; set; } = 0.2;
[InputParameter("K3", sortIndex: 3, 0.01, 1, 0.01, 2)]
public double K3 { get; set; } = 0.2;
[InputParameter("K4", sortIndex: 4, 0.01, 1, 0.01, 2)]
public double K4 { get; set; } = 0.2;
[InputParameter("Data source", sortIndex: 5, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
[InputParameter("alpha 2", sortIndex: 2, minimum: 0.01, maximum: 1.0, increment: 0.01, decimalPlaces: 2)]
public double k2 { get; set; } = 0.3;
[InputParameter("alpha 3", sortIndex: 3, minimum: 0.01, maximum: 1.0, increment: 0.01, decimalPlaces: 2)]
public double k3 { get; set; } = 0.4;
[InputParameter("alpha 4", sortIndex: 4, minimum: 0.01, maximum: 1.0, increment: 0.01, decimalPlaces: 2)]
public double k4 { get; set; } = 0.5;
private Qema? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"QEMA {k1:F2} : {k2:F2} : {k3:F2} : {k4:F2} :{SourceName}";
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 QemaIndicator() : base()
public QemaIndicator()
{
Name = "QEMA - Quad Exponential Moving Average";
Description = "Combines four EMAs with different smoothing factors to reduce lag and improve trend following.";
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "QEMA - Quadruple Exponential Moving Average";
Description = "Quadruple Exponential Moving Average";
Series = new(name: $"QEMA {K1},{K2},{K3},{K4}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Qema(k1, k2, k3, k4);
ma = new Qema(K1, K2, K3, K4);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"QEMA {K1},{K2},{K3},{K4}:{SourceName}";
}
+46 -12
View File
@@ -1,27 +1,61 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class RemaIndicator : IndicatorBase
public class RemaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Regularization Factor", sortIndex: 2, minimum: 0, maximum: 2.5, increment: 0.1, decimalPlaces: 1)]
[InputParameter("Lambda", sortIndex: 2, 0, 1, 0.01, 2)]
public double Lambda { get; set; } = 0.5;
[InputParameter("Data source", sortIndex: 3, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Rema? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"REMA {Period} : {Lambda:F2} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public RemaIndicator() : base()
public RemaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "REMA - Regularized Exponential Moving Average";
Description = "EMA variant with regularization to reduce noise and improve stability in volatile markets.";
Description = "Regularized Exponential Moving Average";
Series = new(name: $"REMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Rema(period: Period, lambda: Lambda);
ma = new Rema(Periods, Lambda);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"REMA {Periods}:{Lambda}:{SourceName}";
}
+46 -12
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class RmaIndicator : IndicatorBase
public class RmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Rma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"RMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods * 2;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public RmaIndicator() : base()
public RmaIndicator()
{
Name = "RMA - Wilder's Moving Average";
Description = "Smoothed moving average that reduces whipsaws, commonly used in RSI calculations.";
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "RMA - Relative Moving Average (Wilder's Moving Average)";
Description = "Relative Moving Average, also known as Wilder's Moving Average";
Series = new(name: $"RMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Rma(Period);
base.InitIndicator();
ma = new Rma(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"RMA {Periods}:{SourceName}";
}
+45 -11
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class SinemaIndicator : IndicatorBase
public class SinemaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Sinema? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"SINEMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public SinemaIndicator() : base()
public SinemaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "SINEMA - Sine-Weighted Moving Average";
Description = "Moving average using sine function for weighting, balancing recent and historical price data.";
Description = "Sine-Weighted Moving Average";
Series = new(name: $"SINEMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Sinema(Period);
base.InitIndicator();
ma = new Sinema(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"SINEMA {Periods}:{SourceName}";
}
+45 -11
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class SmaIndicator : IndicatorBase
public class SmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Sma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"SMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public SmaIndicator() : base()
public SmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "SMA - Simple Moving Average";
Description = "Basic moving average that calculates the arithmetic mean of prices over a specified period.";
Description = "Simple Moving Average";
Series = new(name: $"SMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Sma(Period);
base.InitIndicator();
ma = new Sma(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"SMA {Periods}:{SourceName}";
}
+45 -11
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class SmmaIndicator : IndicatorBase
public class SmmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Smma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"SMMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public SmmaIndicator() : base()
public SmmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "SMMA - Smoothed Moving Average";
Description = "Moving average that gives more weight to recent data while retaining all historical data.";
Description = "Smoothed Moving Average";
Series = new(name: $"SMMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Smma(Period);
base.InitIndicator();
ma = new Smma(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"SMMA {Periods}:{SourceName}";
}
+49 -15
View File
@@ -1,30 +1,64 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class T3Indicator : IndicatorBase
public class T3Indicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Vfactor", sortIndex: 2, 0, 1, 0.01, 2)]
public double Vfactor { get; set; } = 0.62;
[InputParameter("Volume Factor", sortIndex: 2, 0, 1, 0.01, 2)]
public double VolumeFactor { get; set; } = 0.7;
[InputParameter("Use SMA for warmup", sortIndex: 3)]
public bool UseSma { get; set; } = false;
[InputParameter("Use SMA", sortIndex: 3)]
public bool UseSma { get; set; } = true;
[InputParameter("Data source", sortIndex: 4, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private T3? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"T3 {Period} : {Vfactor:F2} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public T3Indicator() : base()
public T3Indicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "T3 - Tillson T3 Moving Average";
Description = "Triple exponential moving average with reduced lag and smoothing, adjustable via volume factor.";
Description = "Tillson T3 Moving Average";
Series = new(name: $"T3 {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new T3(period: Period, vfactor: Vfactor, useSma: UseSma);
base.InitIndicator();
ma = new T3(Periods, VolumeFactor, UseSma);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"T3 {Periods}:{VolumeFactor}:{UseSma}:{SourceName}";
}
+45 -11
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class TemaIndicator : IndicatorBase
public class TemaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Tema? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"TEMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => (int)Math.Ceiling(-Periods * Math.Log(1 - 0.85));
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public TemaIndicator() : base()
public TemaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "TEMA - Triple Exponential Moving Average";
Description = "Moving average that applies EMA three times to reduce lag and improve responsiveness to trends.";
Description = "Triple Exponential Moving Average";
Series = new(name: $"TEMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Tema(period: Period);
ma = new Tema(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"TEMA {Periods}:{SourceName}";
}
+45 -11
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class TrimaIndicator : IndicatorBase
public class TrimaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Trima? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"TRIMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public TrimaIndicator() : base()
public TrimaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "TRIMA - Triangular Moving Average";
Description = "Weighted moving average giving more importance to the middle of the period for smoother output.";
Description = "Triangular Moving Average";
Series = new(name: $"TRIMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Trima(Period);
base.InitIndicator();
ma = new Trima(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"TRIMA {Periods}:{SourceName}";
}
+51 -15
View File
@@ -1,28 +1,64 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class VidyaIndicator : IndicatorBase
public class VidyaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Short Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Long Period", sortIndex: 2, 1, 2000, 1, 0)]
public int LPeriod { get; set; } = 40;
[InputParameter("Alpha", sortIndex: 3, 0, 1, 0.1, 1)]
public double Alpha { get; set; } = 0.4;
[InputParameter("Short Period", sortIndex: 1, 1, 1000, 1, 0)]
public int ShortPeriod { get; set; } = 14;
[InputParameter("Long Period", sortIndex: 2, 0, 1000, 1, 0)]
public int LongPeriod { get; set; } = 0;
[InputParameter("Alpha", sortIndex: 3, 0.01, 1, 0.01, 2)]
public double Alpha { get; set; } = 0.2;
[InputParameter("Data source", sortIndex: 4, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Vidya? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"VIDYA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => LongPeriod == 0 ? ShortPeriod * 4 : LongPeriod;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public VidyaIndicator() : base()
public VidyaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "VIDYA - Variable Index Dynamic Average";
Description = "Adaptive moving average that adjusts based on market volatility for improved trend following.";
Description = "Variable Index Dynamic Average";
Series = new(name: $"VIDYA {ShortPeriod}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Vidya(Period, LPeriod, Alpha);
base.InitIndicator();
ma = new Vidya(ShortPeriod, LongPeriod, Alpha);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"VIDYA {ShortPeriod}:{LongPeriod}:{Alpha}:{SourceName}";
}
+45 -11
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class WmaIndicator : IndicatorBase
public class WmaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Wma? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"WMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public WmaIndicator() : base()
public WmaIndicator()
{
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "WMA - Weighted Moving Average";
Description = "Moving average that assigns higher weights to recent data points for improved responsiveness.";
Description = "Weighted Moving Average";
Series = new(name: $"WMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
ma = new Wma(Period);
base.InitIndicator();
ma = new Wma(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"WMA {Periods}:{SourceName}";
}
+46 -12
View File
@@ -1,24 +1,58 @@
using TradingPlatform.BusinessLayer;
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class ZlemaIndicator : IndicatorBase
public class ZlemaIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
public int Periods { get; set; } = 14;
[InputParameter("Data source", sortIndex: 2, variants: [
"Open", SourceType.Open,
"High", SourceType.High,
"Low", SourceType.Low,
"Close", SourceType.Close,
"HL/2 (Median)", SourceType.HL2,
"OC/2 (Midpoint)", SourceType.OC2,
"OHL/3 (Mean)", SourceType.OHL3,
"HLC/3 (Typical)", SourceType.HLC3,
"OHLC/4 (Average)", SourceType.OHLC4,
"HLCC/4 (Weighted)", SourceType.HLCC4
])]
public SourceType Source { get; set; } = SourceType.Close;
private Zlema? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"ZLEMA {Period} : {SourceName}";
protected LineSeries? Series;
protected string? SourceName;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public ZlemaIndicator() : base()
public ZlemaIndicator()
{
Name = "ZLEMA - Zero-Lag Exponential Moving Average";
Description = "EMA variant that reduces lag by using linear extrapolation, providing faster response to price changes.";
OnBackGround = true;
SeparateWindow = false;
SourceName = Source.ToString();
Name = "ZLEMA - Zero Lag Exponential Moving Average";
Description = "Zero Lag Exponential Moving Average";
Series = new(name: $"ZLEMA {Periods}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
AddLineSeries(Series);
}
protected override void InitIndicator()
protected override void OnInit()
{
base.InitIndicator();
ma = new Zlema(Period);
ma = new Zlema(Periods);
SourceName = Source.ToString();
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TValue input = this.GetInputValue(args, Source);
TValue result = ma!.Calc(input);
Series!.SetValue(result.Value);
}
public override string ShortName => $"ZLEMA {Periods}:{SourceName}";
}
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Averages</AssemblyName>
<AlgoType>Indicator</AlgoType>
<OutputPath>bin\$(Configuration)\</OutputPath>
<IsLocalBuild Condition="'$(GITHUB_ACTIONS)' == ''">true</IsLocalBuild>
@@ -14,7 +15,8 @@
<ItemGroup>
<Compile Include="..\*.cs" />
<Compile Include="*.cs" />
<ProjectReference Include="..\..\lib\quantalib.csproj" Private="true" IncludeAssets="all" />
<Compile Include="..\..\lib\**\*.cs" Exclude="..\..\lib\bin\**;..\..\lib\obj\**" />
<Reference Include="TradingPlatform.BusinessLayer">
<HintPath>..\..\.github\TradingPlatform.BusinessLayer.dll</HintPath>
</Reference>