refresh with new QT DLL

This commit is contained in:
Miha Kralj
2024-10-12 20:36:37 -07:00
parent cc45cebeb4
commit b3b3b24a25
65 changed files with 2593 additions and 1189 deletions
+25 -10
View File
@@ -1,29 +1,44 @@
using System.Drawing;
using TradingPlatform.BusinessLayer;
namespace QuanTAlib;
public class HistoricalIndicator : IndicatorBase
public class HistoricalIndicator : Indicator, IWatchlistIndicator
{
[InputParameter("Period", sortIndex: 1, 1, 2000, 1, 0)]
public int Period { get; set; } = 20;
[InputParameter("Periods", sortIndex: 1, 1, 2000, 1, 0)]
public int Periods { get; set; } = 20;
[InputParameter("Annualized", sortIndex: 2)]
public bool IsAnnualized { get; set; } = true;
private Historical? historical;
protected override AbstractBase QuanTAlib => historical!;
public override string ShortName => $"Historical Volatility {Period}{(IsAnnualized ? " - Annualized" : "")} : {SourceName}";
protected LineSeries? HvSeries;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public HistoricalIndicator() : base()
public HistoricalIndicator()
{
Name = "HV - Historical Volatility";
Description = "Measures price fluctuations over time, indicating market volatility based on past price movements.";
SeparateWindow = true;
HvSeries = new("HV", Color.Blue, 2, LineStyle.Solid);
AddLineSeries(HvSeries);
}
protected override void InitIndicator()
protected override void OnInit()
{
historical = new(Period, IsAnnualized);
MinHistoryDepths = historical.WarmupPeriod;
base.InitIndicator();
historical = new Historical(Periods, IsAnnualized);
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TBar input = IndicatorExtensions.GetInputBar(this, args);
TValue result = historical!.Calc(input);
HvSeries!.SetValue(result.Value);
}
public override string ShortName => $"HV ({Periods}{(IsAnnualized ? " - Annualized" : "")})";
}