mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-13 16:18:05 +00:00
Squash
dotcover s1 .sln s1 s1 s2 s3 s4 s5 s1 s2 x x2 x3 x4 x5 x6 x1 sonarcube cleanup1 sonarcube cleanup2 sonarcube cleanup 3 fixes q q q q q q q q q1 q2 q q1 codacy 1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
using TradingPlatform.BusinessLayer;
|
||||
using QuanTAlib;
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class AlmaIndicator : IndicatorBase
|
||||
{
|
||||
@@ -7,22 +7,21 @@ public class AlmaIndicator : IndicatorBase
|
||||
public int Period { get; set; } = 10;
|
||||
|
||||
[InputParameter("Offset", sortIndex: 5)]
|
||||
public double Offset = 0.85;
|
||||
public double Offset { get; set; } = 0.85;
|
||||
|
||||
[InputParameter("Sigma", sortIndex: 6)]
|
||||
public double Sigma = 6.0;
|
||||
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()
|
||||
public AlmaIndicator()
|
||||
{
|
||||
Name = "ALMA - Arnaud Legoux Moving Average";
|
||||
}
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
base.InitIndicator();
|
||||
ma = new Alma(period: Period, offset: Offset, sigma: Sigma);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using TradingPlatform.BusinessLayer;
|
||||
using QuanTAlib;
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class DemaIndicator : IndicatorBase
|
||||
{
|
||||
@@ -9,14 +9,13 @@ public class DemaIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"DEMA {Period} : {SourceName}";
|
||||
|
||||
public DemaIndicator() : base()
|
||||
public DemaIndicator()
|
||||
{
|
||||
Name = "DEMA - Double Exponential Moving Average";
|
||||
}
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
base.InitIndicator();
|
||||
ma = new Dema(period: Period);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using TradingPlatform.BusinessLayer;
|
||||
using QuanTAlib;
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class DsmaIndicator : IndicatorBase
|
||||
{
|
||||
@@ -10,7 +10,7 @@ public class DsmaIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"DSMA {Period} : {SourceName}";
|
||||
|
||||
public DsmaIndicator() : base()
|
||||
public DsmaIndicator()
|
||||
{
|
||||
Name = "DSMA - Deviation Scaled Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class DsmaIndicator : IndicatorBase
|
||||
{
|
||||
ma = new Dsma(Period);
|
||||
MinHistoryDepths = ma.WarmupPeriod;
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using TradingPlatform.BusinessLayer;
|
||||
using QuanTAlib;
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class DwmaIndicator : IndicatorBase
|
||||
{
|
||||
@@ -11,7 +11,7 @@ public class DwmaIndicator : IndicatorBase
|
||||
public override string ShortName => $"DWMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public DwmaIndicator() : base()
|
||||
public DwmaIndicator()
|
||||
{
|
||||
Name = "DWMA - Double Weighted Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class DwmaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Dwma(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using TradingPlatform.BusinessLayer;
|
||||
using QuanTAlib;
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class EmaIndicator : IndicatorBase
|
||||
{
|
||||
@@ -13,7 +13,7 @@ public class EmaIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"EMA {Period} : {SourceName}";
|
||||
|
||||
public EmaIndicator() : base()
|
||||
public EmaIndicator()
|
||||
{
|
||||
Name = "EMA - Exponential Moving Average";
|
||||
Description = "Exponential Moving Average";
|
||||
@@ -21,7 +21,6 @@ public class EmaIndicator : IndicatorBase
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
base.InitIndicator();
|
||||
ma = new Ema(period: Period, useSma: UseSma);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using TradingPlatform.BusinessLayer;
|
||||
using QuanTAlib;
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class EpmaIndicator : IndicatorBase
|
||||
{
|
||||
@@ -10,14 +10,13 @@ public class EpmaIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"EPMA {Period} : {SourceName}";
|
||||
|
||||
public EpmaIndicator() : base()
|
||||
public EpmaIndicator()
|
||||
{
|
||||
Name = "EPMA - Endpoint Moving Average";
|
||||
}
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
base.InitIndicator();
|
||||
ma = new Epma(period: Period);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using TradingPlatform.BusinessLayer;
|
||||
using QuanTAlib;
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class FramaIndicator : IndicatorBase
|
||||
{
|
||||
@@ -11,7 +11,7 @@ public class FramaIndicator : IndicatorBase
|
||||
public override string ShortName => $"FRAMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public FramaIndicator() : base()
|
||||
public FramaIndicator()
|
||||
{
|
||||
Name = "FRAMA - Fractal Adaptive Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class FramaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Frama(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using TradingPlatform.BusinessLayer;
|
||||
using QuanTAlib;
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class FwmaIndicator : IndicatorBase
|
||||
{
|
||||
@@ -11,7 +11,7 @@ public class FwmaIndicator : IndicatorBase
|
||||
public override string ShortName => $"FWMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public FwmaIndicator() : base()
|
||||
public FwmaIndicator()
|
||||
{
|
||||
Name = "FWMA - Fibonacci-Weighted Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class FwmaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Fwma(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using TradingPlatform.BusinessLayer;
|
||||
using QuanTAlib;
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class GmaIndicator : IndicatorBase
|
||||
{
|
||||
@@ -11,7 +11,7 @@ public class GmaIndicator : IndicatorBase
|
||||
public override string ShortName => $"GMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public GmaIndicator() : base()
|
||||
public GmaIndicator()
|
||||
{
|
||||
Name = "GMA - Gaussian-Weighted Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class GmaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Gma(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class HmaIndicator : IndicatorBase
|
||||
public override string ShortName => $"HMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public HmaIndicator() : base()
|
||||
public HmaIndicator()
|
||||
{
|
||||
Name = "HMA - Hull Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class HmaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Hma(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ public class HtitIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"HTIT : {SourceName}";
|
||||
|
||||
public HtitIndicator() : base()
|
||||
public HtitIndicator()
|
||||
{
|
||||
Name = "HTIT - Hilbert Transform Instantaneous Trendline";
|
||||
}
|
||||
@@ -16,6 +16,5 @@ public class HtitIndicator : IndicatorBase
|
||||
{
|
||||
ma = new Htit();
|
||||
MinHistoryDepths = ma.WarmupPeriod;
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,17 +17,13 @@ public class HwmaIndicator : IndicatorBase
|
||||
public override string ShortName => $"HWMA {nA:F2} : {nB:F2} : {nC:F2} : {SourceName}";
|
||||
|
||||
|
||||
public HwmaIndicator() : base()
|
||||
public HwmaIndicator()
|
||||
{
|
||||
Name = "HWMA - Holt-Winter Moving Average";
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ public class JmaIndicator : IndicatorBase
|
||||
public int Period { get; set; } = 10;
|
||||
|
||||
[InputParameter("Phase", sortIndex: 2, -100, 100, 1, 0)]
|
||||
public int Phase { get; set; } = 0;
|
||||
public int Phase { get; set; }
|
||||
private Jma? ma;
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"JMA {Period} : {Phase} : {SourceName}";
|
||||
|
||||
|
||||
public JmaIndicator() : base()
|
||||
public JmaIndicator()
|
||||
{
|
||||
Name = "JMA - Jurik Moving Average";
|
||||
}
|
||||
@@ -21,6 +21,5 @@ public class JmaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Jma(period: Period, phase: (double)Phase);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class KamaIndicator : IndicatorBase
|
||||
public override string ShortName => $"KAMA {Period} : {Fast} : {Slow} : {SourceName}";
|
||||
|
||||
|
||||
public KamaIndicator() : base()
|
||||
public KamaIndicator()
|
||||
{
|
||||
Name = "KAMA - Kaufman's Adaptive Moving Average";
|
||||
}
|
||||
@@ -23,6 +23,5 @@ public class KamaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Kama(Period, Fast, Slow);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public class LtmaIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"Laguerre {Gamma:F2} : {SourceName}";
|
||||
|
||||
public LtmaIndicator() : base()
|
||||
public LtmaIndicator()
|
||||
{
|
||||
Name = "LTMA - Laguerre Transform Moving Average";
|
||||
}
|
||||
@@ -18,6 +18,5 @@ public class LtmaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Ltma(gamma: Gamma);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,20 +7,19 @@ 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;
|
||||
public double Threshold { get; set; } = 0.002;
|
||||
|
||||
private Maaf? ma;
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"MAAF {Period} : {Threshold:F2} : {SourceName}";
|
||||
|
||||
public MaafIndicator() : base()
|
||||
public MaafIndicator()
|
||||
{
|
||||
Name = "MAAF - Median-Average Adaptive Filter";
|
||||
}
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
base.InitIndicator();
|
||||
ma = new Maaf(Period: Period, Threshold: Threshold);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class MamaIndicator : IndicatorBase
|
||||
public override string ShortName => $"MAMA : {Fast} : {Slow} : {SourceName}";
|
||||
|
||||
|
||||
public MamaIndicator() : base()
|
||||
public MamaIndicator()
|
||||
{
|
||||
Name = "MAMA - MESA Adaptive Moving Average";
|
||||
}
|
||||
@@ -20,6 +20,5 @@ public class MamaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Mama(Fast, Slow);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class MgdiIndicator : IndicatorBase
|
||||
public override string ShortName => $"MGDI {Period} : {kfactor:F2} : {SourceName}";
|
||||
|
||||
|
||||
public MgdiIndicator() : base()
|
||||
public MgdiIndicator()
|
||||
{
|
||||
Name = "MGDI - McGinley Dynamic Index";
|
||||
}
|
||||
@@ -23,6 +23,5 @@ public class MgdiIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Mgdi(period: Period, kFactor: kfactor);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,14 +10,13 @@ public class MmaIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"MMA {Period} : {SourceName}";
|
||||
|
||||
public MmaIndicator() : base()
|
||||
public MmaIndicator()
|
||||
{
|
||||
Name = "MMA - Modified Moving Average";
|
||||
}
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
base.InitIndicator();
|
||||
ma = new Mma(period: Period);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ public class QemaIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"QEMA {k1:F2} : {k2:F2} : {k3:F2} : {k4:F2} :{SourceName}";
|
||||
|
||||
public QemaIndicator() : base()
|
||||
public QemaIndicator()
|
||||
{
|
||||
Name = "QEMA - Quad Exponential Moving Average";
|
||||
Description = "Quad Exponential Moving Average";
|
||||
@@ -24,7 +24,6 @@ public class QemaIndicator : IndicatorBase
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
base.InitIndicator();
|
||||
ma = new Qema(k1, k2, k3, k4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,14 +13,13 @@ public class RemaIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"REMA {Period} : {Lambda:F2} : {SourceName}";
|
||||
|
||||
public RemaIndicator() : base()
|
||||
public RemaIndicator()
|
||||
{
|
||||
Name = "REMA - Regularized Exponential Moving Average";
|
||||
}
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
base.InitIndicator();
|
||||
ma = new Rema(period: Period, lambda: Lambda);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class RmaIndicator : IndicatorBase
|
||||
public override string ShortName => $"RMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public RmaIndicator() : base()
|
||||
public RmaIndicator()
|
||||
{
|
||||
Name = "RMA - wildeR Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class RmaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Rma(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public class SinemaIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"SINEMA {Period} : {SourceName}";
|
||||
|
||||
public SinemaIndicator() : base()
|
||||
public SinemaIndicator()
|
||||
{
|
||||
Name = "SINEMA - Sine-Weighted Moving Average";
|
||||
}
|
||||
@@ -18,6 +18,5 @@ public class SinemaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Sinema(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class SmaIndicator : IndicatorBase
|
||||
public override string ShortName => $"SMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public SmaIndicator() : base()
|
||||
public SmaIndicator()
|
||||
{
|
||||
Name = "SMA - Simple Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class SmaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Sma(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class SmmaIndicator : IndicatorBase
|
||||
public override string ShortName => $"SMMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public SmmaIndicator() : base()
|
||||
public SmmaIndicator()
|
||||
{
|
||||
Name = "SMMA - Smoothed Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class SmmaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Smma(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ public class T3Indicator : IndicatorBase
|
||||
public double Vfactor { get; set; } = 0.62;
|
||||
|
||||
[InputParameter("Use SMA for warmup", sortIndex: 3)]
|
||||
public bool UseSma { get; set; } = false;
|
||||
public bool UseSma { get; set; }
|
||||
|
||||
private T3? ma;
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"T3 {Period} : {Vfactor:F2} : {SourceName}";
|
||||
|
||||
public T3Indicator() : base()
|
||||
public T3Indicator()
|
||||
{
|
||||
Name = "T3 - Tillson T3 Moving Average";
|
||||
}
|
||||
@@ -24,6 +24,5 @@ public class T3Indicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new T3(period: Period, vfactor: Vfactor, useSma: UseSma);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,14 +10,13 @@ public class TemaIndicator : IndicatorBase
|
||||
protected override AbstractBase QuanTAlib => ma!;
|
||||
public override string ShortName => $"TEMA {Period} : {SourceName}";
|
||||
|
||||
public TemaIndicator() : base()
|
||||
public TemaIndicator()
|
||||
{
|
||||
Name = "TEMA - Triple Exponential Moving Average";
|
||||
}
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
base.InitIndicator();
|
||||
ma = new Tema(period: Period);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class TrimaIndicator : IndicatorBase
|
||||
public override string ShortName => $"TRIMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public TrimaIndicator() : base()
|
||||
public TrimaIndicator()
|
||||
{
|
||||
Name = "TRIMA - Triangular Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class TrimaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Trima(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public class VidyaIndicator : IndicatorBase
|
||||
public override string ShortName => $"VIDYA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public VidyaIndicator() : base()
|
||||
public VidyaIndicator()
|
||||
{
|
||||
Name = "VIDYA - Variable Index Dynamic Average";
|
||||
}
|
||||
@@ -23,6 +23,5 @@ public class VidyaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Vidya(Period, LPeriod, Alpha);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class WmaIndicator : IndicatorBase
|
||||
public override string ShortName => $"WMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public WmaIndicator() : base()
|
||||
public WmaIndicator()
|
||||
{
|
||||
Name = "WMA - Weighted Moving Average";
|
||||
}
|
||||
@@ -19,6 +19,5 @@ public class WmaIndicator : IndicatorBase
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
ma = new Wma(Period);
|
||||
base.InitIndicator();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,14 +11,13 @@ public class ZlemaIndicator : IndicatorBase
|
||||
public override string ShortName => $"ZLEMA {Period} : {SourceName}";
|
||||
|
||||
|
||||
public ZlemaIndicator() : base()
|
||||
public ZlemaIndicator()
|
||||
{
|
||||
Name = "ZLEMA - Weighted Moving Average";
|
||||
}
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
base.InitIndicator();
|
||||
ma = new Zlema(Period);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@ using TradingPlatform.BusinessLayer;
|
||||
using TradingPlatform.BusinessLayer.Chart;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Drawing.Drawing2D;
|
||||
using QuanTAlib;
|
||||
using System.Collections;
|
||||
using TradingPlatform.BusinessLayer.TimeSync;
|
||||
|
||||
namespace QuanTAlib;
|
||||
|
||||
#pragma warning disable CA1416 // Validate platform compatibility
|
||||
public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
||||
{
|
||||
@@ -27,7 +28,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 20)]
|
||||
public bool ShowColdValues { get; set; } = true;
|
||||
public int MinHistoryDepths;
|
||||
public int MinHistoryDepths { get; set; }
|
||||
|
||||
// LineSeries.LineSeries(string, Color, int, LineStyle)'
|
||||
|
||||
@@ -37,7 +38,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
||||
|
||||
int IWatchlistIndicator.MinHistoryDepths => 0;
|
||||
|
||||
protected IndicatorBase() : base()
|
||||
protected IndicatorBase()
|
||||
{
|
||||
OnBackGround = true;
|
||||
SeparateWindow = false;
|
||||
@@ -45,13 +46,9 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
||||
Series = new(name: $"{Name}", color: Color.Yellow, width: 2, style: LineStyle.Solid);
|
||||
|
||||
AddLineSeries(Series);
|
||||
InitIndicator();
|
||||
}
|
||||
|
||||
protected virtual void InitIndicator()
|
||||
{
|
||||
SourceName = GetName(Source);
|
||||
}
|
||||
protected abstract void InitIndicator();
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
@@ -95,7 +92,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
||||
{
|
||||
base.OnPaintChart(args);
|
||||
List<Point> allPoints = new List<Point>();
|
||||
if (CurrentChart == null) return;
|
||||
if (CurrentChart == null) { return; }
|
||||
|
||||
Graphics gr = args.Graphics;
|
||||
var mainWindow = this.CurrentChart.Windows[args.WindowIndex];
|
||||
@@ -126,7 +123,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
||||
|
||||
private void DrawSmoothCombinedCurve(Graphics gr, List<Point> allPoints, int hotCount)
|
||||
{
|
||||
if (allPoints.Count < 2) return;
|
||||
if (allPoints.Count < 2) { return; }
|
||||
|
||||
using (Pen defaultPen = new(Series!.Color, Series.Width) { DashStyle = ConvertLineStyleToDashStyle(Series.Style) })
|
||||
using (Pen coldPen = new(Series!.Color, Series.Width) { DashStyle = DashStyle.Dot })
|
||||
@@ -146,7 +143,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
||||
}
|
||||
}
|
||||
}
|
||||
private DashStyle ConvertLineStyleToDashStyle(LineStyle lineStyle)
|
||||
private static DashStyle ConvertLineStyleToDashStyle(LineStyle lineStyle)
|
||||
{
|
||||
return lineStyle switch
|
||||
{
|
||||
@@ -157,7 +154,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
||||
_ => DashStyle.Solid,
|
||||
};
|
||||
}
|
||||
protected void DrawText(Graphics gr, string text, Rectangle clientRect)
|
||||
protected static void DrawText(Graphics gr, string text, Rectangle clientRect)
|
||||
{
|
||||
Font font = new Font("Inter", 8);
|
||||
SizeF textSize = gr.MeasureString(text, font);
|
||||
@@ -167,7 +164,7 @@ public abstract class IndicatorBase : Indicator, IWatchlistIndicator
|
||||
gr.FillRectangle(SystemBrushes.ControlDarkDark, textRect);
|
||||
gr.DrawString(text, font, Brushes.White, new PointF(textRect.X + 6, textRect.Y + 5));
|
||||
}
|
||||
protected string GetName(int pType)
|
||||
protected static string GetName(int pType)
|
||||
{
|
||||
return pType switch
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user