Files
QuanTAlib/lib/dynamics/ht_trendmode/HtTrendmode.Quantower.Tests.cs
T
Miha Kralj 3dd05f23e4 Refactor indicators to include "Ehlers" in names and descriptions for clarity
- Updated the name and description of the Hilbert Trendline (HTIT) to "Ehlers Hilbert Transform Instantaneous Trend (HTIT)".
- Changed the name and description of the MESA Adaptive Moving Average (MAMA) to "Ehlers MESA Adaptive Moving Average".
- Modified the Center of Gravity (CG) indicator to "Ehlers Center of Gravity (CG)".
- Renamed the Detrended Synthetic Price (DSP) to "Ehlers Detrended Synthetic Price (DSP)".
- Updated the Autocorrelation Periodogram (EACP) to "Ehlers Autocorrelation Periodogram (EACP)".
- Changed the Homodyne Discriminator (HOMOD) to "Ehlers Homodyne Discriminator (HOMOD)".
- Updated the Hilbert Transform Dominant Cycle Period and Phase indicators to include "Ehlers" in their names.
- Renamed the Hilbert Transform Phasor Components to "Ehlers Hilbert Transform Phasor Components (HT_PHASOR)".
- Updated the SineWave indicator to "Ehlers Hilbert Transform SineWave (HT_SINE)".
- Changed the Phasor Analysis indicator to "Ehlers Hilbert Transform Phasor Components (HT_PHASOR)".
- Updated the SSF-Based Detrended Synthetic Price to "Ehlers SSF Detrended Synthetic Price (SSFDSP)".
- Renamed the Ultimate Channel to "Ehlers Ultimate Channel (UCHANNEL)".
- Added new indicators: Moving Average Variable Period (MAVP), Ehlers Predictive Moving Average (PMA), Ehlers Reverse EMA (REVERSEEMA), and Ehlers Trendflex Indicator (TRENDFLEX).
- Updated various SVG badges to reflect changes in classes, comments, source files, lines of code, methods, and public types.
2026-02-18 19:08:15 -08:00

80 lines
2.5 KiB
C#

using TradingPlatform.BusinessLayer;
using QuanTAlib;
namespace QuanTAlib.Tests;
public class HtTrendmodeIndicatorTests
{
[Fact]
public void HtTrendmodeIndicator_Constructor_SetsDefaults()
{
var indicator = new HtTrendmodeIndicator();
Assert.Equal(SourceType.Close, indicator.SourceInput);
Assert.True(indicator.ShowColdValues);
Assert.Equal("HT_TRENDMODE - Ehlers Hilbert Transform Trend vs Cycle Mode", indicator.Name);
Assert.True(indicator.SeparateWindow);
Assert.True(indicator.OnBackGround);
}
[Fact]
public void HtTrendmodeIndicator_MinHistoryDepths_EqualsZero()
{
var indicator = new HtTrendmodeIndicator();
Assert.Equal(0, HtTrendmodeIndicator.MinHistoryDepths);
IWatchlistIndicator watchlistIndicator = indicator;
Assert.Equal(0, watchlistIndicator.MinHistoryDepths);
}
[Fact]
public void HtTrendmodeIndicator_Initialize_CreatesInternalIndicator()
{
var indicator = new HtTrendmodeIndicator();
// Initialize should not throw
indicator.Initialize();
// After init, line series should exist (TrendMode)
Assert.Single(indicator.LinesSeries);
}
[Fact]
public void HtTrendmodeIndicator_ProcessUpdate_HistoricalBar_ComputesValue()
{
var indicator = new HtTrendmodeIndicator();
indicator.Initialize();
// Add historical data
var now = DateTime.UtcNow;
for (int i = 0; i < 50; i++)
{
indicator.HistoricalData.AddBar(now.AddMinutes(i), 100 + i, 110 + i, 90 + i, 105 + i);
// Process update for each bar to simulate history loading
var args = new UpdateArgs(UpdateReason.HistoricalBar);
indicator.ProcessUpdate(args);
}
// Line series should have a value
double trendMode = indicator.LinesSeries[0].GetValue(0);
Assert.True(double.IsFinite(trendMode));
}
[Fact]
public void HtTrendmodeIndicator_ShortName_IsCorrect()
{
var indicator = new HtTrendmodeIndicator();
Assert.Equal("HT_TRENDMODE", indicator.ShortName);
}
[Fact]
public void HtTrendmodeIndicator_SourceCodeLink_IsValid()
{
var indicator = new HtTrendmodeIndicator();
Assert.Contains("github.com", indicator.SourceCodeLink, StringComparison.OrdinalIgnoreCase);
Assert.Contains("HtTrendmode.Quantower.cs", indicator.SourceCodeLink, StringComparison.OrdinalIgnoreCase);
}
}