public void SMACrossProbe_OHLCFeed_DoesNotTriggerAnEvent() { //Arrange var forexPair = MockObjectFactory.MockTickerSymbol(MockObjectFactory.EURUSD); var timeFrame = new TimeframeUnit(TimeframeOption.M1); var feedService = MockObjectFactory.MockManualPriceFeedService(); var ticker = feedService.Setup(forexPair.Object, timeFrame, OHLCPriceOption.All); var isTriggered = false; var smaCross = new SMACrossProbe(ticker, 3, 5, () => isTriggered = true); smaCross.Subscribe(feedService); var priceSwing = MockDataFactory.ExtractOHLCPrices(MockDataFactory.PriceSwingBeginMarker, MockDataFactory.PriceSwingEndMarker, -1); //Act priceSwing.ForEach((s) => feedService.OHLC.PriceAction(ticker, s)); //Assert Assert.IsFalse(isTriggered); Assert.AreEqual(0, smaCross.Length); }
public void SMACrossProbe_PriceBarOptionFeedTriggersAnEvent() { //Arrange var forexPair = MockObjectFactory.MockTickerSymbol(MockObjectFactory.EURUSD); var timeFrame = new TimeframeUnit(TimeframeOption.M1); var feedService = MockObjectFactory.MockManualPriceFeedService(); var ticker = feedService.Setup(forexPair.Object, timeFrame, PriceBarOption.Close); var isTriggered = false; var smaCross = new SMACrossProbe(ticker, 2, 5, () => isTriggered = true); smaCross.Subscribe(feedService); feedService.Start(); var priceSwing = MockDataFactory.ExtractPrices(MockDataFactory.PriceSwingBeginMarker, MockDataFactory.PriceSwingEndMarker); //Act priceSwing.ForEach((s) => feedService.PriceBar.PriceAction(ticker, s.TimeStamp, PriceBarOption.Close, s.Close)); //Assert Assert.IsTrue(isTriggered); Assert.IsTrue(smaCross.Current.Status == EventStateOption.On); }