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 RealizedIndicator : IndicatorBase
public class RealizedIndicator : 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 Realized? realized;
protected override AbstractBase QuanTAlib => realized!;
public override string ShortName => $"Realized Volatility {Period}{(IsAnnualized ? " - Annualized" : "")} : {SourceName}";
protected LineSeries? RvSeries;
public int MinHistoryDepths => Periods;
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
public RealizedIndicator() : base()
public RealizedIndicator()
{
Name = "RV - Realized Volatility";
Description = "Measures actual price volatility over a specific period, useful for risk assessment and forecasting.";
SeparateWindow = true;
RvSeries = new("RV", Color.Blue, 2, LineStyle.Solid);
AddLineSeries(RvSeries);
}
protected override void InitIndicator()
protected override void OnInit()
{
realized = new(Period, IsAnnualized);
MinHistoryDepths = realized.WarmupPeriod;
base.InitIndicator();
realized = new Realized(Periods, IsAnnualized);
base.OnInit();
}
protected override void OnUpdate(UpdateArgs args)
{
TBar input = IndicatorExtensions.GetInputBar(this, args);
TValue result = realized!.Calc(input);
RvSeries!.SetValue(result.Value);
}
public override string ShortName => $"RV ({Periods}{(IsAnnualized ? " - Annualized" : "")})";
}