public void ComparesWithExternalData() { // this test currently fails 57 points const int maxFailures = 57; int totalFailures = 0; var aroon = new AroonOscillator(14, 14); TestHelper.TestIndicator(aroon, "spy_aroon_oscillator.txt", "Aroon Oscillator 14", (i, expected) => { try { Assert.AreEqual(expected, (double) aroon.Current.Value, 1e-3); } catch { totalFailures++; } }); if (totalFailures > maxFailures) { Assert.Fail("Aroon did worse than previously expected. Failed: {0} Expected: {1}", totalFailures, maxFailures); } else { Console.WriteLine("Aroon failed {0} data points against an expected of {1}", totalFailures, maxFailures); } }
public void ResetsProperly() { var aroon = new AroonOscillator(3, 3); aroon.Update(new TradeBar { Symbol = Symbols.SPY, Time = DateTime.Today, Open = 3m, High = 7m, Low = 2m, Close = 5m, Volume = 10 }); aroon.Update(new TradeBar { Symbol = Symbols.SPY, Time = DateTime.Today.AddSeconds(1), Open = 3m, High = 7m, Low = 2m, Close = 5m, Volume = 10 }); aroon.Update(new TradeBar { Symbol = Symbols.SPY, Time = DateTime.Today.AddSeconds(2), Open = 3m, High = 7m, Low = 2m, Close = 5m, Volume = 10 }); Assert.IsFalse(aroon.IsReady); aroon.Update(new TradeBar { Symbol = Symbols.SPY, Time = DateTime.Today.AddSeconds(3), Open = 3m, High = 7m, Low = 2m, Close = 5m, Volume = 10 }); Assert.IsTrue(aroon.IsReady); aroon.Reset(); TestHelper.AssertIndicatorIsInDefaultState(aroon); TestHelper.AssertIndicatorIsInDefaultState(aroon.AroonUp); TestHelper.AssertIndicatorIsInDefaultState(aroon.AroonDown); }
public void ComparesWithExternalData() { var aroon = new AroonOscillator(14, 14); TestHelper.TestIndicator(aroon, "spy_aroon_oscillator.txt", "Aroon Oscillator 14", (i, expected) => Assert.AreEqual(expected, (double)aroon.Current.Value, 1e-3)); }