mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-13 08:08:05 +00:00
Periods -> Period, DataSource attribute
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user