Files
QuanTAlib/lib/momentum/rsx/tests/Rsx.Repro.Tests.cs
T
Miha Kralj 060649192f docs: remove C# Implementation Considerations sections, clean up temp scripts, reorganize test files
- Remove 'C# Implementation Considerations' sections from 34 indicator .md files
- Delete 29 temp PowerShell scripts (_fix_mojibake.ps1, _hex_scan.ps1, etc.)
- Move test files into tests/ subdirectories for consistent project structure
- Add trader-focused bullet points to indicator documentation
2026-03-12 12:34:16 -07:00

33 lines
1.0 KiB
C#

namespace QuanTAlib.Tests;
public class RsxReproTests
{
[Fact]
public void LastValidValue_ShouldNotUpdate_WhenIsNewIsFalse()
{
// Arrange
var rsx = new Rsx(2);
// Warmup to ensure initialization
rsx.Update(new TValue(DateTime.UtcNow, 100), true);
rsx.Update(new TValue(DateTime.UtcNow, 100), true);
rsx.Update(new TValue(DateTime.UtcNow, 100), true);
// Update: Valid value, isNew=false (Transient update)
// This should NOT persist 200 as LastValidValue for the next bar.
rsx.Update(new TValue(DateTime.UtcNow, 200), false);
// Update: NaN value, isNew=true
// Should use LastValidValue.
// If bug exists: uses 200. Momentum = 200 - 100 = 100.
// If fixed: uses 100. Momentum = 100 - 100 = 0.
var res = rsx.Update(new TValue(DateTime.UtcNow, double.NaN), true);
// If momentum was 0, RSX should be 50.
// If momentum was 100, RSX should be > 50.
Assert.Equal(50.0, res.Value, 1e-6);
}
}