//Test correct default behavior (data void action) public void TestInvokeType_Excluding_failed() { //Arrange List <InvokeLinkVoid <Bar> > OnTest = new List <InvokeLinkVoid <Bar> >(); OnTest.Add(new InvokeLinkVoid <Bar>() { Action = TestOnbar, BaseType = _type, DataStreams = new[] { _stream }, ParmType = _type }); //Act _sut.InvokeAllExclude(OnTest, _bardata, _type); //Assert _touchedbar.Should().BeFalse(); }
/// <summary> /// Execute the on bar event for each new bar to be processed by the associated modules /// </summary> /// <param name="bar"></param> public void OnBar(Bar bar) { LocalLog(LogLevel.Trace, "OnBar: Processing bar Symbol: {0}, Interval: {1}", bar.Symbol, bar.CustomInterval); //Check for BackFilling IsBackfilling = BackFillingBars > 0; //Execute all OnBar events (Indicators first) if (string.IsNullOrWhiteSpace(bar.Symbol)) { return; } DataStream stream = Portfolio.Streams[bar.Symbol]; if (stream == null || stream.Security == null || stream.Security.Name != bar.Symbol) { LocalLog(LogLevel.Error, "Could not find stream for symbol {0}", bar.Symbol); } //Execute all OnBar events (Indicators) Exec.InvokeAll(_invokeOnBar, bar, stream, typeof(IndicatorModule), typeof(Indicators.IndicatorBase)); //Execute all OnBar events (nonIndicators) Exec.InvokeAllExclude(_invokeOnBar, bar, typeof(IndicatorModule), typeof(Indicators.IndicatorBase)); //check for main timeframe if (bar.CustomInterval != (int)TimeFrame.TotalSeconds) { LocalLog(LogLevel.Trace, "OnBar: Bar is discarded for agent calc events, expected interval: {0} but found interval: {1}", TimeFrame.TotalSeconds, bar.CustomInterval); return; } else { LocalLog(LogLevel.Trace, "OnBar: Bar is processed for agent calc event, found interval: {0}", bar.CustomInterval); } //Check all entry module logic ClearAgentSate(); Exec.InvokeAll(OnCalcEvents, typeof(EntryModule)); Entry(); //Check all exit module logic ClearAgentSate(); Exec.InvokeAll(OnCalcEvents, typeof(ExitModule)); Exit(); }