public void ResetsProperly() { var cci = new CommodityChannelIndex(2); cci.Update(new TradeBar { Symbol = "SPY", Time = DateTime.Today, Open = 3m, High = 7m, Low = 2m, Close = 5m, Volume = 10 }); Assert.IsFalse(cci.IsReady); cci.Update(new TradeBar { Symbol = "SPY", Time = DateTime.Today.AddSeconds(1), Open = 3m, High = 7m, Low = 2m, Close = 5m, Volume = 10 }); Assert.IsTrue(cci.IsReady); cci.Reset(); TestHelper.AssertIndicatorIsInDefaultState(cci); TestHelper.AssertIndicatorIsInDefaultState(cci.TypicalPriceAverage); TestHelper.AssertIndicatorIsInDefaultState(cci.TypicalPriceMeanDeviation); }
public void ResetsProperly() { var mfi = new MoneyFlowIndex(3); foreach (var data in TestHelper.GetDataStream(4)) { var tradeBar = new TradeBar { Open = data.Value, Close = data.Value, High = data.Value, Low = data.Value, Volume = Decimal.ToInt64(data.Value) }; mfi.Update(tradeBar); } Assert.IsTrue(mfi.IsReady); Assert.IsTrue(mfi.PositiveMoneyFlow.IsReady); Assert.IsTrue(mfi.NegativeMoneyFlow.IsReady); Assert.AreNotEqual(mfi.PreviousTypicalPrice, 0.0m); mfi.Reset(); Assert.AreEqual(mfi.PreviousTypicalPrice, 0.0m); TestHelper.AssertIndicatorIsInDefaultState(mfi); TestHelper.AssertIndicatorIsInDefaultState(mfi.PositiveMoneyFlow); TestHelper.AssertIndicatorIsInDefaultState(mfi.NegativeMoneyFlow); }
public override void ResetsProperly() { var aps = new AugenPriceSpike(10); var reference = DateTime.Today; aps.Update(reference.AddMinutes(1), 5); aps.Update(reference.AddMinutes(2), 10); aps.Update(reference.AddMinutes(3), 8); aps.Update(reference.AddMinutes(4), 12); aps.Update(reference.AddMinutes(5), 103); aps.Update(reference.AddMinutes(6), 82); aps.Update(reference.AddMinutes(7), 55); aps.Update(reference.AddMinutes(8), 10); aps.Update(reference.AddMinutes(9), 878); aps.Update(reference.AddMinutes(10), 84); aps.Update(reference.AddMinutes(11), 832); aps.Update(reference.AddMinutes(12), 81); aps.Update(reference.AddMinutes(13), 867); aps.Update(reference.AddMinutes(14), 89); Assert.IsTrue(aps.IsReady); Assert.AreNotEqual(0m, aps.Current.Value); aps.Reset(); TestHelper.AssertIndicatorIsInDefaultState(aps); }
public override void ResetsProperly() { var bb = new BollingerBands(2, 2m); bb.Update(DateTime.Today, 1m); Assert.IsFalse(bb.IsReady); bb.Update(DateTime.Today.AddSeconds(1), 2m); Assert.IsTrue(bb.IsReady); Assert.IsTrue(bb.StandardDeviation.IsReady); Assert.IsTrue(bb.LowerBand.IsReady); Assert.IsTrue(bb.MiddleBand.IsReady); Assert.IsTrue(bb.UpperBand.IsReady); Assert.IsTrue(bb.BandWidth.IsReady); Assert.IsTrue(bb.PercentB.IsReady); bb.Reset(); TestHelper.AssertIndicatorIsInDefaultState(bb); TestHelper.AssertIndicatorIsInDefaultState(bb.StandardDeviation); TestHelper.AssertIndicatorIsInDefaultState(bb.LowerBand); TestHelper.AssertIndicatorIsInDefaultState(bb.MiddleBand); TestHelper.AssertIndicatorIsInDefaultState(bb.UpperBand); TestHelper.AssertIndicatorIsInDefaultState(bb.BandWidth); TestHelper.AssertIndicatorIsInDefaultState(bb.PercentB); }
public void ResetsProperlyStandardDeviation() { var std = new StandardDeviation(3); std.Update(DateTime.Today, 1m); std.Update(DateTime.Today.AddSeconds(1), 5m); std.Update(DateTime.Today.AddSeconds(2), 1m); Assert.IsTrue(std.IsReady); std.Reset(); TestHelper.AssertIndicatorIsInDefaultState(std); }
public void ResetsProperly() { var momersion = new MomersionIndicator(7, 20); RunTestIndicator(momersion, _expectedMinPeriod); Assert.IsTrue(momersion.IsReady); momersion.Reset(); TestHelper.AssertIndicatorIsInDefaultState(momersion); }
public void ResetsProperly() { var aroon = new AroonOscillator(3, 3); aroon.Update(new TradeBar { Symbol = "SPY", Time = DateTime.Today, Open = 3m, High = 7m, Low = 2m, Close = 5m, Volume = 10 }); aroon.Update(new TradeBar { Symbol = "SPY", Time = DateTime.Today.AddSeconds(1), Open = 3m, High = 7m, Low = 2m, Close = 5m, Volume = 10 }); aroon.Update(new TradeBar { Symbol = "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 = "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 ResetsProperly() { var fisher = new FisherTransform(10); //fisher.Update(DateTime.Today, 1m); //fisher.Update(DateTime.Today.AddSeconds(1), 2m); Assert.IsFalse(fisher.IsReady); fisher.Reset(); TestHelper.AssertIndicatorIsInDefaultState(fisher); //TestHelper.AssertIndicatorIsInDefaultState(fisher.AverageGain); //TestHelper.AssertIndicatorIsInDefaultState(fisher.AverageLoss); }
public override void ResetsProperly() { var rsi = new RelativeStrengthIndex(2); rsi.Update(DateTime.Today, 1m); rsi.Update(DateTime.Today.AddSeconds(1), 2m); Assert.IsFalse(rsi.IsReady); rsi.Reset(); TestHelper.AssertIndicatorIsInDefaultState(rsi); TestHelper.AssertIndicatorIsInDefaultState(rsi.AverageGain); TestHelper.AssertIndicatorIsInDefaultState(rsi.AverageLoss); }
public void ResetsProperly(int?minPeriod, int fullPeriod) { var momersion = new MomersionIndicator(minPeriod, fullPeriod); var expected = minPeriod.HasValue ? _expectedMinPeriod : _expectedFullPeriod; RunTestIndicator(momersion, expected); Assert.IsTrue(momersion.IsReady); momersion.Reset(); TestHelper.AssertIndicatorIsInDefaultState(momersion); }
public void ResetsProperlyMaximum() { var max = new Maximum(3); max.Update(DateTime.Today, 1m); max.Update(DateTime.Today.AddSeconds(1), 2m); max.Update(DateTime.Today.AddSeconds(2), 1m); Assert.IsTrue(max.IsReady); max.Reset(); Assert.AreEqual(0, max.PeriodsSinceMaximum); TestHelper.AssertIndicatorIsInDefaultState(max); }
public void ResetsProperly() { var min = new Minimum(3); min.Update(DateTime.Today, 1m); min.Update(DateTime.Today.AddSeconds(1), 2m); min.Update(DateTime.Today.AddSeconds(2), 1m); Assert.IsTrue(min.IsReady); min.Reset(); Assert.AreEqual(0, min.PeriodsSinceMinimum); TestHelper.AssertIndicatorIsInDefaultState(min); }
public void ResetsProperly() { var wilr = new WilliamsPercentR(14); foreach (var data in TestHelper.GetTradeBarStream("spy_with_williamsR14.txt", false)) { wilr.Update(data); } Assert.IsTrue(wilr.IsReady); wilr.Reset(); TestHelper.AssertIndicatorIsInDefaultState(wilr); }
public void ResetsProperly() { var momp = new MomentumPercent(50); foreach (var data in TestHelper.GetDataStream(51)) { momp.Update(data); } Assert.IsTrue(momp.IsReady); momp.Reset(); TestHelper.AssertIndicatorIsInDefaultState(momp); }
public void ResetsProperly() { var mad = new MeanAbsoluteDeviation(3); mad.Update(DateTime.Today, 1m); mad.Update(DateTime.Today.AddSeconds(1), 2m); mad.Update(DateTime.Today.AddSeconds(1), 1m); Assert.IsTrue(mad.IsReady); mad.Reset(); TestHelper.AssertIndicatorIsInDefaultState(mad); TestHelper.AssertIndicatorIsInDefaultState(mad.Mean); }
public void ResetsProperly() { var roc = new RateOfChange(50); foreach (var data in TestHelper.GetDataStream(51)) { roc.Update(data); } Assert.IsTrue(roc.IsReady); roc.Reset(); TestHelper.AssertIndicatorIsInDefaultState(roc); }
public void ResetsProperly() { const int period = 10; var indicator = new RegressionChannel(period, 2); var time = DateTime.Now; for (var i = 0; i < period + 1; i++) { indicator.Update(time.AddMinutes(i), 1m); } Assert.IsTrue(indicator.IsReady, "Regression Channel ready"); indicator.Reset(); TestHelper.AssertIndicatorIsInDefaultState(indicator); }
public void ResetsProperly() { var sma = new SimpleMovingAverage(3); foreach (var data in TestHelper.GetDataStream(4)) { sma.Update(data); } Assert.IsTrue(sma.IsReady); sma.Reset(); TestHelper.AssertIndicatorIsInDefaultState(sma); }
public void ResetsProperly() { var onBalanceVolumeIndicator = new OnBalanceVolume("OBV"); foreach (var data in TestHelper.GetTradeBarStream("spy_with_obv.txt", false)) { onBalanceVolumeIndicator.Update(data); } Assert.IsTrue(onBalanceVolumeIndicator.IsReady); onBalanceVolumeIndicator.Reset(); TestHelper.AssertIndicatorIsInDefaultState(onBalanceVolumeIndicator); }
public void ResetsProperly() { var delay = new Delay(2); foreach (var data in TestHelper.GetDataStream(3)) { delay.Update(data); } Assert.IsTrue(delay.IsReady); Assert.AreEqual(3, delay.Samples); delay.Reset(); TestHelper.AssertIndicatorIsInDefaultState(delay); }
public override void ResetsProperly() { var indicator = CreateIndicator(); var time = DateTime.Now; for (var i = 0; i < 20; i++) { indicator.Update(time.AddMinutes(i), Prices[i]); Assert.AreEqual(Expected[i], Math.Round(indicator.Current.Value, 4)); } Assert.IsTrue(indicator.IsReady, "LeastSquaresMovingAverage Ready"); indicator.Reset(); TestHelper.AssertIndicatorIsInDefaultState(indicator); }
public override void ResetsProperly() { var sum = (Sum)CreateIndicator(); RunTestIndicator(sum); Assert.IsTrue(sum.IsReady); sum.Reset(); TestHelper.AssertIndicatorIsInDefaultState(sum); Assert.AreEqual(sum.Current.Value, 0m); sum.Update(DateTime.UtcNow, 1); Assert.AreEqual(sum.Current.Value, 1m); }
public void ResetsProperly() { var bop = new BalanceOfPower("BOP"); foreach (var data in TestHelper.GetTradeBarStream("spy_bop.txt", false)) { bop.Update(data); } Assert.IsTrue(bop.IsReady); bop.Reset(); TestHelper.AssertIndicatorIsInDefaultState(bop); }
public override void ResetsProperly() { var ind = CreateIndicator(); foreach (var data in TestHelper.GetTradeBarStream(TestFileName)) { ind.Update(data); } Assert.IsTrue(ind.IsReady); ind.Reset(); TestHelper.AssertIndicatorIsInDefaultState(ind); ind.Update(new TradeBar(DateTime.UtcNow, Symbols.SPY, 2m, 2m, 2m, 2m, 1)); Assert.AreEqual(ind.Current.Value, 2m); }
public void ResetsProperly() { var ind = new VolumeWeightedAveragePriceIndicator(50); foreach (var data in TestHelper.GetTradeBarStream("spy_with_vwap.txt")) { ind.Update(data); } Assert.IsTrue(ind.IsReady); ind.Reset(); TestHelper.AssertIndicatorIsInDefaultState(ind); ind.Update(new TradeBar(DateTime.UtcNow, Symbols.SPY, 2m, 2m, 2m, 2m, 1)); Assert.AreEqual(ind.Current.Value, 2m); }
public void ResetsProperly() { var date = DateTime.Today; var variance = new Variance("VAR", 10); foreach (var data in TestHelper.GetTradeBarStream("spy_var.txt")) { variance.Update(date, data.Close); } Assert.IsTrue(variance.IsReady); variance.Reset(); TestHelper.AssertIndicatorIsInDefaultState(variance); }
public void ResetsProperly() { int LSMAPeriod = 10; DateTime time = DateTime.Now; LeastSquaresMovingAverage LSMA = new LeastSquaresMovingAverage(LSMAPeriod); for (int i = 0; i < LSMAPeriod + 1; i++) { LSMA.Update(new IndicatorDataPoint(time, 1m)); time = time.AddMinutes(1); } Assert.IsTrue(LSMA.IsReady, "LSMA ready"); LSMA.Reset(); TestHelper.AssertIndicatorIsInDefaultState(LSMA); }
public void ResetsProperly() { var indicator = new WindowIdentity(3); foreach (var data in TestHelper.GetDataStream(4)) { indicator.Update(data); } Assert.IsTrue(indicator.IsReady); indicator.Reset(); TestHelper.AssertIndicatorIsInDefaultState(indicator); indicator.Update(DateTime.UtcNow, 2.0m); Assert.AreEqual(indicator.Current.Value, 2.0m); }
public void ResetsProperly() { var sak = new SwissArmyKnife(4, 0.1, SwissArmyKnifeTool.BandPass); foreach (var data in TestHelper.GetDataStream(5)) { sak.Update(data); } Assert.IsTrue(sak.IsReady); Assert.AreNotEqual(0m, sak.Current.Value); Assert.AreNotEqual(0, sak.Samples); sak.Reset(); TestHelper.AssertIndicatorIsInDefaultState(sak); }
public override void ResetsProperly() { // ema reset is just setting the value and samples back to 0 var ema = new ExponentialMovingAverage(3); foreach (var data in TestHelper.GetDataStream(5)) { ema.Update(data); } Assert.IsTrue(ema.IsReady); Assert.AreNotEqual(0m, ema.Current.Value); Assert.AreNotEqual(0, ema.Samples); ema.Reset(); TestHelper.AssertIndicatorIsInDefaultState(ema); }