tests and cleanup

This commit is contained in:
Miha Kralj
2024-10-11 18:02:09 -07:00
parent 839313c9f2
commit cc45cebeb4
96 changed files with 3640 additions and 327 deletions
+3 -3
View File
@@ -9,8 +9,6 @@ public class AfirmaIndicator : IndicatorBase
[InputParameter("Periods for lowpass cutoff", sortIndex: 2, 1, 2000, 1, 0)]
public int Periods { get; set; } = 6;
[InputParameter("Window Type", sortIndex: 3, variants: [
"Rectangular", Afirma.WindowType.Rectangular,
"Hanning", Afirma.WindowType.Hanning1,
@@ -32,6 +30,8 @@ public class AfirmaIndicator : IndicatorBase
protected override void InitIndicator()
{
base.InitIndicator();
ma = new Afirma(periods: Periods, taps: Taps, window: Window);
}
}
}
+2
View File
@@ -18,6 +18,8 @@ public class AlmaIndicator : IndicatorBase
public AlmaIndicator() : base()
{
Name = "ALMA - Arnaud Legoux Moving Average";
Description = "Arnaud Legoux Moving Average";
}
protected override void InitIndicator()
+10 -12
View File
@@ -5,28 +5,26 @@
<IsLocalBuild Condition="'$(GITHUB_ACTIONS)' == ''">true</IsLocalBuild>
<UpdateAssemblyInfo>true</UpdateAssemblyInfo>
<GenerateGitVersionInformation>true</GenerateGitVersionInformation>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="8.0.0" />
<Compile Include="..\..\lib\**\*.cs" Exclude="..\..\lib\obj\**">
<Link>lib\%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>
<Target Name="CopyCustomContent" AfterTargets="AfterBuild" Condition="'$(IsLocalBuild)' == 'true'">
<Copy SourceFiles="$(OutputPath)\Averages.dll" DestinationFolder="$(QuantowerRoot)\Settings\Scripts\Indicators\QuanTAlib\Averages" />
</Target>
<ItemGroup>
<Compile Include="..\*.cs">
<Link>%(Filename)%(Extension)</Link>
</Compile>
<Compile Include="..\*.cs" />
<Compile Include="*.cs" />
<ProjectReference Include="..\..\lib\quantalib.csproj" Private="true" IncludeAssets="all" />
<Reference Include="TradingPlatform.BusinessLayer">
<HintPath>..\..\.github\TradingPlatform.BusinessLayer.dll</HintPath>
<HintPath>..\..\.github\TradingPlatform.BusinessLayer.dll</HintPath>
</Reference>
<None Include="..\..\.github\TradingPlatform.BusinessLayer.xml">
<Link>TradingPlatform.BusinessLayer.xml</Link>
</None>
</ItemGroup>
</Project>
<Target Name="CopyCustomContent" AfterTargets="AfterBuild" Condition="'$(IsLocalBuild)' == 'true'">
<Copy SourceFiles="$(OutputPath)\Averages.dll" DestinationFolder="$(QuantowerRoot)\Settings\Scripts\Indicators\QuanTAlib\Averages" />
</Target>
</Project>
+1
View File
@@ -12,6 +12,7 @@ public class DemaIndicator : IndicatorBase
public DemaIndicator() : base()
{
Name = "DEMA - Double Exponential Moving Average";
Description = "A faster-responding moving average that reduces lag by applying the EMA twice.";
}
protected override void InitIndicator()
+1
View File
@@ -15,6 +15,7 @@ public class DsmaIndicator : IndicatorBase
public DsmaIndicator() : base()
{
Name = "DSMA - Deviation Scaled Moving Average";
Description = "A moving average that adjusts its responsiveness based on price deviations from the mean.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -10,10 +10,10 @@ public class DwmaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"DWMA {Period} : {SourceName}";
public DwmaIndicator() : base()
{
Name = "DWMA - Double Weighted Moving Average";
Description = "A moving average that applies double weighting to recent prices for increased responsiveness.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -16,7 +16,7 @@ public class EmaIndicator : IndicatorBase
public EmaIndicator() : base()
{
Name = "EMA - Exponential Moving Average";
Description = "Exponential Moving Average";
Description = "Moving average that gives more weight to recent prices, reducing lag in trend following.";
}
protected override void InitIndicator()
+1
View File
@@ -13,6 +13,7 @@ public class EpmaIndicator : IndicatorBase
public EpmaIndicator() : base()
{
Name = "EPMA - Endpoint Moving Average";
Description = "Moving average that emphasizes the most recent data point, useful for identifying trend changes.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -10,10 +10,10 @@ public class FramaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"FRAMA {Period} : {SourceName}";
public FramaIndicator() : base()
{
Name = "FRAMA - Fractal Adaptive Moving Average";
Description = "Adaptive moving average that adjusts its smoothing based on market fractal dimension.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -10,10 +10,10 @@ public class FwmaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"FWMA {Period} : {SourceName}";
public FwmaIndicator() : base()
{
Name = "FWMA - Fibonacci-Weighted Moving Average";
Description = "Moving average that uses Fibonacci sequence for weighting, emphasizing recent and key historical prices.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -10,10 +10,10 @@ public class GmaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"GMA {Period} : {SourceName}";
public GmaIndicator() : base()
{
Name = "GMA - Gaussian-Weighted Moving Average";
Description = "Moving average using Gaussian distribution for weighting, balancing recent and historical data.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -10,10 +10,10 @@ public class HmaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"HMA {Period} : {SourceName}";
public HmaIndicator() : base()
{
Name = "HMA - Hull Moving Average";
Description = "Responsive moving average that reduces lag while maintaining smoothness in price action.";
}
protected override void InitIndicator()
+1
View File
@@ -10,6 +10,7 @@ public class HtitIndicator : IndicatorBase
public HtitIndicator() : base()
{
Name = "HTIT - Hilbert Transform Instantaneous Trendline";
Description = "Uses Hilbert Transform to identify the dominant cycle and generate a smooth, lag-free trendline.";
}
protected override void InitIndicator()
+1 -4
View File
@@ -16,17 +16,14 @@ public class HwmaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"HWMA {nA:F2} : {nB:F2} : {nC:F2} : {SourceName}";
public HwmaIndicator() : base()
{
Name = "HWMA - Holt-Winter Moving Average";
Description = "Triple exponential moving average that accounts for level, trend, and seasonal components.";
}
protected override void InitIndicator()
{
//nA = 2 / (1 + (double)Period);
//nB = 1 / (double)Period;
//nC = 1 / (double)Period;
ma = new Hwma(nA: nA, nB: nB, nC: nC);
base.InitIndicator();
}
+1 -1
View File
@@ -12,10 +12,10 @@ public class JmaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"JMA {Period} : {Phase} : {SourceName}";
public JmaIndicator() : base()
{
Name = "JMA - Jurik Moving Average";
Description = "Adaptive moving average with reduced lag and noise, adjustable smoothness and phase shift.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -14,10 +14,10 @@ public class KamaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"KAMA {Period} : {Fast} : {Slow} : {SourceName}";
public KamaIndicator() : base()
{
Name = "KAMA - Kaufman's Adaptive Moving Average";
Description = "Adaptive moving average that adjusts to market volatility, reducing lag in trending markets.";
}
protected override void InitIndicator()
+1
View File
@@ -13,6 +13,7 @@ public class LtmaIndicator : IndicatorBase
public LtmaIndicator() : base()
{
Name = "LTMA - Laguerre Transform Moving Average";
Description = "Moving average using Laguerre polynomials, offering adjustable smoothing and lag reduction.";
}
protected override void InitIndicator()
+3 -2
View File
@@ -7,7 +7,7 @@ public class MaafIndicator : IndicatorBase
public int Period { get; set; } = 39;
[InputParameter("Threshold", sortIndex: 5, minimum: 0, maximum: 1, increment: 0.001, decimalPlaces: 3)]
public double Threshold = 0.002;
private double Threshold { get; set; } = 0.002;
private Maaf? ma;
protected override AbstractBase QuanTAlib => ma!;
@@ -16,11 +16,12 @@ public class MaafIndicator : IndicatorBase
public MaafIndicator() : base()
{
Name = "MAAF - Median-Average Adaptive Filter";
Description = "Adaptive filter combining median and average, reducing noise while preserving trend responsiveness.";
}
protected override void InitIndicator()
{
base.InitIndicator();
ma = new Maaf(Period: Period, Threshold: Threshold);
ma = new Maaf(period: Period, threshold: Threshold);
}
}
+1 -1
View File
@@ -11,10 +11,10 @@ public class MamaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"MAMA : {Fast} : {Slow} : {SourceName}";
public MamaIndicator() : base()
{
Name = "MAMA - MESA Adaptive Moving Average";
Description = "Adaptive moving average using MESA algorithm to adjust to market cycles and reduce lag.";
}
protected override void InitIndicator()
+1 -2
View File
@@ -9,15 +9,14 @@ public class MgdiIndicator : IndicatorBase
[InputParameter("k Factor", sortIndex: 2, minimum: 0.0, maximum: 1.0, increment: 0.1, decimalPlaces: 2)]
public double kfactor { get; set; } = 0.6;
private Mgdi? ma;
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"MGDI {Period} : {kfactor:F2} : {SourceName}";
public MgdiIndicator() : base()
{
Name = "MGDI - McGinley Dynamic Index";
Description = "Adaptive moving average that adjusts to market speed, reducing whipsaws in trending markets.";
}
protected override void InitIndicator()
+1
View File
@@ -13,6 +13,7 @@ public class MmaIndicator : IndicatorBase
public MmaIndicator() : base()
{
Name = "MMA - Modified Moving Average";
Description = "Variation of EMA that reduces lag and smooths price action, balancing responsiveness and stability.";
}
protected override void InitIndicator()
+1
View File
@@ -13,6 +13,7 @@ public class PwmaIndicator : IndicatorBase
public PwmaIndicator() : base()
{
Name = "PWMA - Pascal's Weighted Moving Average";
Description = "Moving average using Pascal's triangle coefficients, emphasizing recent data with smooth transitions.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -19,7 +19,7 @@ public class QemaIndicator : IndicatorBase
public QemaIndicator() : base()
{
Name = "QEMA - Quad Exponential Moving Average";
Description = "Quad Exponential Moving Average";
Description = "Combines four EMAs with different smoothing factors to reduce lag and improve trend following.";
}
protected override void InitIndicator()
+1
View File
@@ -16,6 +16,7 @@ public class RemaIndicator : IndicatorBase
public RemaIndicator() : base()
{
Name = "REMA - Regularized Exponential Moving Average";
Description = "EMA variant with regularization to reduce noise and improve stability in volatile markets.";
}
protected override void InitIndicator()
+2 -2
View File
@@ -10,10 +10,10 @@ public class RmaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"RMA {Period} : {SourceName}";
public RmaIndicator() : base()
{
Name = "RMA - wildeR Moving Average";
Name = "RMA - Wilder's Moving Average";
Description = "Smoothed moving average that reduces whipsaws, commonly used in RSI calculations.";
}
protected override void InitIndicator()
+1
View File
@@ -13,6 +13,7 @@ public class SinemaIndicator : IndicatorBase
public SinemaIndicator() : base()
{
Name = "SINEMA - Sine-Weighted Moving Average";
Description = "Moving average using sine function for weighting, balancing recent and historical price data.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -10,10 +10,10 @@ public class SmaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"SMA {Period} : {SourceName}";
public SmaIndicator() : base()
{
Name = "SMA - Simple Moving Average";
Description = "Basic moving average that calculates the arithmetic mean of prices over a specified period.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -10,10 +10,10 @@ public class SmmaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"SMMA {Period} : {SourceName}";
public SmmaIndicator() : base()
{
Name = "SMMA - Smoothed Moving Average";
Description = "Moving average that gives more weight to recent data while retaining all historical data.";
}
protected override void InitIndicator()
+1
View File
@@ -19,6 +19,7 @@ public class T3Indicator : IndicatorBase
public T3Indicator() : base()
{
Name = "T3 - Tillson T3 Moving Average";
Description = "Triple exponential moving average with reduced lag and smoothing, adjustable via volume factor.";
}
protected override void InitIndicator()
+1
View File
@@ -13,6 +13,7 @@ public class TemaIndicator : IndicatorBase
public TemaIndicator() : base()
{
Name = "TEMA - Triple Exponential Moving Average";
Description = "Moving average that applies EMA three times to reduce lag and improve responsiveness to trends.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -10,10 +10,10 @@ public class TrimaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"TRIMA {Period} : {SourceName}";
public TrimaIndicator() : base()
{
Name = "TRIMA - Triangular Moving Average";
Description = "Weighted moving average giving more importance to the middle of the period for smoother output.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -14,10 +14,10 @@ public class VidyaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"VIDYA {Period} : {SourceName}";
public VidyaIndicator() : base()
{
Name = "VIDYA - Variable Index Dynamic Average";
Description = "Adaptive moving average that adjusts based on market volatility for improved trend following.";
}
protected override void InitIndicator()
+1 -1
View File
@@ -10,10 +10,10 @@ public class WmaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"WMA {Period} : {SourceName}";
public WmaIndicator() : base()
{
Name = "WMA - Weighted Moving Average";
Description = "Moving average that assigns higher weights to recent data points for improved responsiveness.";
}
protected override void InitIndicator()
+2 -2
View File
@@ -10,10 +10,10 @@ public class ZlemaIndicator : IndicatorBase
protected override AbstractBase QuanTAlib => ma!;
public override string ShortName => $"ZLEMA {Period} : {SourceName}";
public ZlemaIndicator() : base()
{
Name = "ZLEMA - Weighted Moving Average";
Name = "ZLEMA - Zero-Lag Exponential Moving Average";
Description = "EMA variant that reduces lag by using linear extrapolation, providing faster response to price changes.";
}
protected override void InitIndicator()