I'm working on a 5 minute strategy, that started off as a 1 and 5 minute multi time-series strategy. Anyways, I'm noticing something strange when I remove or comment out the line
AddDataSeries(BarsPeriodType.Minute, 5);
The strategy now only takes about 60-70% of the trades it took when that line was left in. From my understanding, if the strategy is designed to run on a 5 minute chart, AddDataSeries() doesn't need to be called at all. It just needs to be set to a 5 minute data series on a chart or in the Strategy Analyzer.
Can a NinjaTrader expert take a look at my strategy code below, and do the following?
1) Uncomment AddDataSeries(BarsPeriodType.Minute, 5);
2) Change (starts on line 320)
if(BarsInProgress == 1 && CurrentBar >= 3){
if(IsSwingHigh())
listSwingHighs.Add(Draw.Line(this, string.Format("MSS{0}", CurrentBar), false, 2, High[1], -1, High[1], Brushes.Green, DashStyleHelper.Dash, 1));
else if(IsSwingLow())
listSwingLows.Add(Draw.Line(this, string.Format("MSS{0}", CurrentBar), false, 2, Low[1], -1, Low[1], Brushes.Red, DashStyleHelper.Dash, 1));
}
to
if(BarsInProgress == 0 && CurrentBar >= 3){
if(IsSwingHigh())
listSwingHighs.Add(Draw.Line(this, string.Format("MSS{0}", CurrentBar), false, 2, High[1], -1, High[1], Brushes.Green, DashStyleHelper.Dash, 1));
else if(IsSwingLow())
listSwingLows.Add(Draw.Line(this, string.Format("MSS{0}", CurrentBar), false, 2, Low[1], -1, Low[1], Brushes.Red, DashStyleHelper.Dash, 1));
}
3) Run a backtest and note how many trades are taken
4) Then, completely remove the 5 minute data series and change all references to BarsInProgress to 0 (primary series) and BarsArray[0] to just Bars
I am desperately trying to understand why the number of trades are different, when the entry logic is exactly the same code. The only thing is that it changes from a multi time-series strategy to a single.
Any help would be appreciated. Thanks!
Comment