mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-07-30 02:27:43 +00:00
58f0812584
- Implemented Vortex Indicator in Vortex.cs, including calculation logic and event handling. - Added detailed documentation for Vortex Indicator in Vortex.md, covering historical context, algorithm, outputs, and trading interpretation. - Updated oscillators index to include TTM Wave indicator. - Added TTM Wave documentation with algorithm and trading interpretation. - Updated reversals index to include TTM Scalper Alert indicator. - Added TTM Scalper Alert documentation with algorithm and trading strategy. - Updated NDepend badges to reflect increased code metrics (classes, methods, lines of code, public types, comments, and complexity).
60 lines
2.1 KiB
C#
60 lines
2.1 KiB
C#
using System.Drawing;
|
|
using System.Runtime.CompilerServices;
|
|
using TradingPlatform.BusinessLayer;
|
|
|
|
namespace QuanTAlib;
|
|
|
|
[SkipLocalsInit]
|
|
public sealed class DxIndicator : Indicator, IWatchlistIndicator
|
|
{
|
|
[InputParameter("Period", sortIndex: 1, 1, 1000, 1, 0)]
|
|
public int Period { get; set; } = 14;
|
|
|
|
[InputParameter("Show cold values", sortIndex: 21)]
|
|
public bool ShowColdValues { get; set; } = true;
|
|
|
|
private Dx _dx = null!;
|
|
private readonly LineSeries _dxSeries;
|
|
private readonly LineSeries _diPlusSeries;
|
|
private readonly LineSeries _diMinusSeries;
|
|
|
|
public static int MinHistoryDepths => 0;
|
|
int IWatchlistIndicator.MinHistoryDepths => MinHistoryDepths;
|
|
|
|
public override string ShortName => $"DX {Period}";
|
|
public override string SourceCodeLink => "https://github.com/mihakralj/QuanTAlib/blob/main/lib/dynamics/dx/Dx.Quantower.cs";
|
|
|
|
public DxIndicator()
|
|
{
|
|
OnBackGround = true;
|
|
SeparateWindow = true;
|
|
Name = "DX - Directional Movement Index";
|
|
Description = "Measures the strength of directional movement (unsmoothed)";
|
|
|
|
_dxSeries = new LineSeries(name: "DX", color: Color.Yellow, width: 2, style: LineStyle.Solid);
|
|
_diPlusSeries = new LineSeries(name: "+DI", color: Color.Green, width: 1, style: LineStyle.Solid);
|
|
_diMinusSeries = new LineSeries(name: "-DI", color: Color.Red, width: 1, style: LineStyle.Solid);
|
|
|
|
AddLineSeries(_dxSeries);
|
|
AddLineSeries(_diPlusSeries);
|
|
AddLineSeries(_diMinusSeries);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
protected override void OnInit()
|
|
{
|
|
_dx = new Dx(Period);
|
|
base.OnInit();
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
protected override void OnUpdate(UpdateArgs args)
|
|
{
|
|
TValue result = _dx.Update(this.GetInputBar(args), args.IsNewBar());
|
|
|
|
_dxSeries.SetValue(result.Value, _dx.IsHot, ShowColdValues);
|
|
_diPlusSeries.SetValue(_dx.DiPlus.Value, _dx.IsHot, ShowColdValues);
|
|
_diMinusSeries.SetValue(_dx.DiMinus.Value, _dx.IsHot, ShowColdValues);
|
|
}
|
|
}
|