mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-20 11:38:05 +00:00
Macd
This commit is contained in:
@@ -58,6 +58,7 @@ public class EventingTests
|
||||
("Trima", new Trima(p), new Trima(input, p)),
|
||||
("Vidya", new Vidya(p), new Vidya(input, p)),
|
||||
("Apo", new Apo(12, 26), new Apo(input, 12, 26)),
|
||||
("Macd", new Macd(12, 26, 9), new Macd(input, 12, 26, 9)),
|
||||
("Rsi", new Rsi(p), new Rsi(input, p)),
|
||||
("Rsx", new Rsx(p), new Rsx(input, p)),
|
||||
("Cmo", new Cmo(p), new Cmo(input, p)),
|
||||
|
||||
@@ -120,6 +120,21 @@ public class MomentumUpdateTests
|
||||
Assert.Equal(initialValue, finalValue, precision);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Macd_Update()
|
||||
{
|
||||
var indicator = new Macd(fastPeriod: 12, slowPeriod: 26, signalPeriod: 9);
|
||||
double initialValue = indicator.Calc(new TValue(DateTime.Now, ReferenceValue, IsNew: true));
|
||||
|
||||
for (int i = 0; i < RandomUpdates; i++)
|
||||
{
|
||||
indicator.Calc(new TValue(DateTime.Now, GetRandomDouble() + 100, IsNew: false)); // Ensure positive prices
|
||||
}
|
||||
double finalValue = indicator.Calc(new TValue(DateTime.Now, ReferenceValue, IsNew: false));
|
||||
|
||||
Assert.Equal(initialValue, finalValue, precision);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Pmo_Update()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user