PDA

View Full Version : Problem with strategy and two instruments


MicroAl
12-02-2009, 11:32 AM
Hi

I am having trouble with referring to two instruments in a strategy. Using a single instrument YM chart I have added a custom strategy. I have added a second data series using

protectedoverridevoid Initialize()
{
CalculateOnBarClose = true;

Add("ES 12-09", PeriodType.Minute, 5);
}

In On bar update I have the following lines:

string1 etc = CurrentDayOHL().CurrentLow[0].ToString();
This is returning the value of the second data series not the first ie YM

string2 etc = Closes[1][0].ToString();

This line is working correctly

The question is how do I get string1 to equal the value relating to the first data series ie YM in this case?

NinjaTrader_Josh
12-02-2009, 11:54 AM
MicroAl,

Please be sure you are working within the correct BarsInProgress context.

if (BarsInProgress == 0) <-- you are in YM
if (BarsInProgress == 1) <-- you are in ES

MicroAl
12-02-2009, 12:28 PM
Josh

Thanks. Used a check as suggested - solved problem