Files
QuanTAlib/quantower/Averages/DsmaIndicator.cs
T

27 lines
805 B
C#
Raw Normal View History

2024-09-22 17:31:24 -07:00
using TradingPlatform.BusinessLayer;
2024-09-24 16:41:26 -07:00
using QuanTAlib;
2024-09-22 17:31:24 -07:00
public class DsmaIndicator : IndicatorBase
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 10;
2024-09-24 16:28:16 -07:00
[InputParameter("Scale factor", sortIndex: 2, minimum: 0.01, maximum: 1.0, increment: 0.01, decimalPlaces: 2)]
public double Scale { get; set; } = 0.5;
2024-09-22 17:31:24 -07:00
private Dsma? ma;
protected override AbstractBase QuanTAlib => ma!;
2024-09-24 16:28:16 -07:00
public override string ShortName => $"DSMA {Period} : {Scale:F2} : {SourceName}";
2024-09-22 17:31:24 -07:00
2024-09-24 16:41:26 -07:00
public DsmaIndicator() : base()
2024-09-22 17:31:24 -07:00
{
Name = "DSMA - Deviation Scaled Moving Average";
}
protected override void InitIndicator()
{
2024-09-24 16:28:16 -07:00
ma = new Dsma(Period, Scale);
2024-09-22 17:31:24 -07:00
MinHistoryDepths = ma.WarmupPeriod;
2024-09-24 16:41:26 -07:00
base.InitIndicator();
2024-09-22 17:31:24 -07:00
}
}