I have a strategy and its working fine. However when I add a data series to the strategy without any other code changes the strategy starts placing random trades continuously. The strategy that I have written uses the EURUSD 1 min data. When I add the line below to AddDataSeries then the strategy stops working correctly. This is the only additional line of code I have added. I haven't added any code to access the 2nd data series yet.
else if (State == State.Configure)
{
AddDataSeries("AUDUSD", Data.BarsPeriodType.Minute, 1);
}
Now what is strange is if I add the line below to add the EURUSD it starts working again however the strategy output is slightly different then if I had the two lines of code below commented out. Note in the strategy analyzer I have the instrument selected as EURUSD at 1 min.
else if (State == State.Configure)
{
AddDataSeries("AUDUSD", Data.BarsPeriodType.Minute, 1);
AddDataSeries("EURUSD", Data.BarsPeriodType.Minute, 1);
}
My question is am I missing something when wanting to use another data series. I'm using NinjaTrader 8.0.0.10. Why when I add the line 'AddDataSeries("AUDUSD", Data.BarsPeriodType.Minute, 1);' it completely changes the output of my strategy without any other code changes?
I also found that when getting the value of the highest bar it gets the value of the AUDUSD data series and then the value of the EURUSD data series in random order with the code below.
int highestBarsAgo = HighestBar(High, 100);
double highestPrice = High[highestBarsAgo];
Print(highestPrice);
I have been using the link below as reference for correct usage of AddDataSeries.
Cheers,
Mark
Comment