Periods -> Period, DataSource attribute

This commit is contained in:
Miha Kralj
2024-11-08 17:11:18 -08:00
parent 61a16bd5e3
commit 5bcdf8d614
75 changed files with 370 additions and 1053 deletions
+6 -6
View File
@@ -5,15 +5,15 @@ namespace QuanTAlib;
public class CviIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 20;
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 20;
[InputParameter("Show cold values", sortIndex: 21)]
public bool ShowColdValues { get; set; } = true;
private Cvi? cvi;
protected LineSeries? CviSeries;
public int MinHistoryDepths => Math.Max(5, Periods * 2);
public int MinHistoryDepths => Math.Max(5, Period * 2);
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public CviIndicator()
@@ -22,13 +22,13 @@ public class CviIndicator : Indicator, IWatchlistIndicator
Description = "Measures the volatility of a financial instrument by comparing the spread between the high and low prices.";
SeparateWindow = true;
CviSeries = new($"CVI {Periods}", color: IndicatorExtensions.Volatility, 2, LineStyle.Solid);
CviSeries = new($"CVI {Period}", color: IndicatorExtensions.Volatility, 2, LineStyle.Solid);
AddLineSeries(CviSeries);
}
protected override void OnInit()
{
cvi = new Cvi(Periods);
cvi = new Cvi(Period);
base.OnInit();
}
@@ -43,7 +43,7 @@ public class CviIndicator : Indicator, IWatchlistIndicator
#pragma warning disable CA1416 // Validate platform compatibility
public override string ShortName => $"CVI ({Periods})";
public override string ShortName => $"CVI ({Period})";
public override void OnPaintChart(PaintChartEventArgs args)
{