mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 17:48:05 +00:00
refresh with new QT DLL
This commit is contained in:
@@ -1,26 +1,41 @@
|
||||
using System.Drawing;
|
||||
using TradingPlatform.BusinessLayer;
|
||||
|
||||
namespace QuanTAlib;
|
||||
|
||||
public class RviIndicator : IndicatorBase
|
||||
public class RviIndicator : Indicator, IWatchlistIndicator
|
||||
{
|
||||
[InputParameter("Period", sortIndex: 1, 2, 100, 1, 0)]
|
||||
public int Period { get; set; } = 10;
|
||||
[InputParameter("Periods", sortIndex: 1, 2, 100, 1, 0)]
|
||||
public int Periods { get; set; } = 10;
|
||||
|
||||
private Rvi? rvi;
|
||||
protected override AbstractBase QuanTAlib => rvi!;
|
||||
public override string ShortName => $"RVI {Period} : {SourceName}";
|
||||
protected LineSeries? RviSeries;
|
||||
public int MinHistoryDepths => Periods;
|
||||
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
||||
|
||||
public RviIndicator() : base()
|
||||
public RviIndicator()
|
||||
{
|
||||
Name = "RVI - Relative Volatility Index";
|
||||
Description = "Measures the direction of volatility, helping to identify overbought or oversold conditions in price.";
|
||||
SeparateWindow = true;
|
||||
}
|
||||
|
||||
protected override void InitIndicator()
|
||||
{
|
||||
rvi = new Rvi(Period);
|
||||
MinHistoryDepths = rvi.WarmupPeriod;
|
||||
base.InitIndicator();
|
||||
RviSeries = new("RVI", Color.Blue, 2, LineStyle.Solid);
|
||||
AddLineSeries(RviSeries);
|
||||
}
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
rvi = new Rvi(Periods);
|
||||
base.OnInit();
|
||||
}
|
||||
|
||||
protected override void OnUpdate(UpdateArgs args)
|
||||
{
|
||||
TBar input = IndicatorExtensions.GetInputBar(this, args);
|
||||
TValue result = rvi!.Calc(input);
|
||||
|
||||
RviSeries!.SetValue(result.Value);
|
||||
}
|
||||
|
||||
public override string ShortName => $"RVI ({Periods})";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user