mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-18 02:28:05 +00:00
Periods -> Period, DataSource attribute
This commit is contained in:
@@ -5,8 +5,8 @@ namespace QuanTAlib;
|
||||
|
||||
public class KamaIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Periods", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Periods { get; set; } = 10;
|
||||
[InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
|
||||
public int Period { get; set; } = 10;
|
||||
|
||||
[InputParameter("Fast", sortIndex: 2, 1, 100, 1, 0)]
|
||||
public int Fast { get; set; } = 2;
|
||||
@@ -14,18 +14,7 @@ public class KamaIndicator : Indicator, IWatchlistIndicator
|
||||
[InputParameter("Slow", sortIndex: 3, 1, 100, 1, 0)]
|
||||
public int Slow { get; set; } = 30;
|
||||
|
||||
[InputParameter("Data source", sortIndex: 4, variants: [
|
||||
"Open", SourceType.Open,
|
||||
"High", SourceType.High,
|
||||
"Low", SourceType.Low,
|
||||
"Close", SourceType.Close,
|
||||
"HL/2 (Median)", SourceType.HL2,
|
||||
"OC/2 (Midpoint)", SourceType.OC2,
|
||||
"OHL/3 (Mean)", SourceType.OHL3,
|
||||
"HLC/3 (Typical)", SourceType.HLC3,
|
||||
"OHLC/4 (Average)", SourceType.OHLC4,
|
||||
"HLCC/4 (Weighted)", SourceType.HLCC4
|
||||
])]
|
||||
[IndicatorExtensions.DataSourceInput]
|
||||
public SourceType Source { get; set; } = SourceType.Close;
|
||||
|
||||
[InputParameter("Show cold values", sortIndex: 21)]
|
||||
@@ -34,10 +23,10 @@ public class KamaIndicator : Indicator, IWatchlistIndicator
|
||||
private Kama? ma;
|
||||
protected LineSeries? Series;
|
||||
protected string? SourceName;
|
||||
public int MinHistoryDepths => Periods;
|
||||
public int MinHistoryDepths => Period;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public override string ShortName => $"KAMA {Periods}:{Fast}:{Slow}:{SourceName}";
|
||||
public override string ShortName => $"KAMA {Period}:{Fast}:{Slow}:{SourceName}";
|
||||
|
||||
public KamaIndicator()
|
||||
{
|
||||
@@ -46,13 +35,13 @@ public class KamaIndicator : Indicator, IWatchlistIndicator
|
||||
SourceName = Source.ToString();
|
||||
Name = "KAMA - Kaufman's Adaptive Moving Average";
|
||||
Description = "Kaufman's Adaptive Moving Average";
|
||||
Series = new(name: $"KAMA {Periods}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid);
|
||||
Series = new(name: $"KAMA {Period}", color: IndicatorExtensions.Averages, width: 2, style: LineStyle.Solid);
|
||||
AddLineSeries(Series);
|
||||
}
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
ma = new Kama(Periods, Fast, Slow);
|
||||
ma = new Kama(Period, Fast, Slow);
|
||||
SourceName = Source.ToString();
|
||||
base.OnInit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user