Files
QuanTAlib/lib/momentum/vel/Vel.Validation.Tests.cs
T
Miha Kralj a82f6b7949 Refactor: Remove unnecessary using directives across multiple files
- Cleaned up code by removing unused using directives from various test and implementation files in the trends and volume directories.
- This includes files related to HMA, HTIT, JMA, KAMA, LSMA, MAMA, MGDI, PWMA, RMA, SMA, SSF, SUPER, T3, TEMA, TRIMA, USF, VIDYA, WMA, ATR, ADL, and ADOSC.
- Improved code readability and maintainability by streamlining imports.
2025-12-28 23:55:24 -08:00

32 lines
824 B
C#

namespace QuanTAlib.Tests;
public class VelValidationTests
{
[Fact]
public void Vel_Matches_PwmaMinusWma()
{
// VEL = PWMA - WMA
// We validate this relationship holds true for a random sequence of data.
int period = 10;
var vel = new Vel(period);
var pwma = new Pwma(period);
var wma = new Wma(period);
var gbm = new GBM(startPrice: 100.0, mu: 0.02, sigma: 0.1, seed: 42);
for (int i = 0; i < 100; i++)
{
var bar = gbm.Next(isNew: true);
var input = new TValue(bar.Time, bar.Close);
var v = vel.Update(input);
var p = pwma.Update(input);
var w = wma.Update(input);
Assert.Equal(p.Value - w.Value, v.Value, ValidationHelper.DefaultTolerance);
}
}
}