mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-20 03:28:05 +00:00
- 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.
32 lines
824 B
C#
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);
|
|
}
|
|
}
|
|
}
|