mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 09:38:05 +00:00
- 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
33 lines
1.0 KiB
C#
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);
|
|
}
|
|
}
|