Files
QuanTAlib/quantower/Statistics/PercentileIndicator.cs
T

28 lines
829 B
C#
Raw Normal View History

2024-09-22 17:31:24 -07:00
using TradingPlatform.BusinessLayer;
2024-09-22 20:10:05 -07:00
namespace QuanTAlib;
2024-09-22 17:31:24 -07:00
public class PercentileIndicator : IndicatorBase
{
[InputParameter("Period", sortIndex: 1, 2, 2000, 1, 0)]
public int Period { get; set; } = 20;
[InputParameter("Percent", sortIndex: 2, 0, 100, 1, 0)]
public double Percent { get; set; } = 50;
private Percentile? percentile;
protected override AbstractBase QuanTAlib => percentile!;
public override string ShortName => $"PERCENTILE {Period} {Percent:F0}% : {SourceName}";
2024-09-24 16:41:26 -07:00
public PercentileIndicator() : base()
2024-09-22 17:31:24 -07:00
{
Name = "PERCENTILE - n-th Percentile ";
SeparateWindow = false;
}
protected override void InitIndicator()
{
percentile = new(Period, Percent);
MinHistoryDepths = percentile.WarmupPeriod;
2024-09-24 16:41:26 -07:00
base.InitIndicator();
2024-09-22 17:31:24 -07:00
}
}