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 AtrIndicator : 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 Atr? atr;
protected LineSeries? AtrSeries;
public int MinHistoryDepths => Math.Max(5, Periods * 2);
public int MinHistoryDepths => Math.Max(5, Period * 2);
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public AtrIndicator()
@@ -22,13 +22,13 @@ public class AtrIndicator : Indicator, IWatchlistIndicator
Description = "Measures market volatility by calculating the average range between high and low prices.";
SeparateWindow = true;
AtrSeries = new($"ATR {Periods}", Color.Blue, 2, LineStyle.Solid);
AtrSeries = new($"ATR {Period}", Color.Blue, 2, LineStyle.Solid);
AddLineSeries(AtrSeries);
}
protected override void OnInit()
{
atr = new Atr(Periods);
atr = new Atr(Period);
base.OnInit();
}
@@ -42,7 +42,7 @@ public class AtrIndicator : Indicator, IWatchlistIndicator
}
#pragma warning disable CA1416 // Validate platform compatibility
public override string ShortName => $"ATR ({Periods})";
public override string ShortName => $"ATR ({Period})";
public override void OnPaintChart(PaintChartEventArgs args)
{