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 VarianceIndicator : IndicatorBase
|
|
|
|
|
{
|
|
|
|
|
[InputParameter("Period", sortIndex: 1, minimum: 2, maximum: 2000, increment: 1, decimalPlaces: 0)]
|
|
|
|
|
public int Period { get; set; } = 20;
|
|
|
|
|
|
|
|
|
|
[InputParameter("Population", sortIndex: 2)]
|
2024-09-24 16:41:26 -07:00
|
|
|
public bool IsPopulation { get; set; } = false;
|
2024-09-22 17:31:24 -07:00
|
|
|
|
|
|
|
|
private Variance? variance;
|
|
|
|
|
protected override AbstractBase QuanTAlib => variance!;
|
|
|
|
|
public override string ShortName => $"VAR {Period} : {SourceName}";
|
2024-09-24 16:41:26 -07:00
|
|
|
public VarianceIndicator() : base()
|
2024-09-22 17:31:24 -07:00
|
|
|
{
|
|
|
|
|
Name = "VAR - Variance";
|
|
|
|
|
SeparateWindow = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void InitIndicator()
|
|
|
|
|
{
|
|
|
|
|
SeparateWindow = true;
|
|
|
|
|
variance = new(Period, IsPopulation);
|
|
|
|
|
MinHistoryDepths = variance.WarmupPeriod;
|
2024-09-24 16:41:26 -07:00
|
|
|
base.InitIndicator();
|
2024-09-22 17:31:24 -07:00
|
|
|
}
|
|
|
|
|
}
|