good day to everyone,
i have been evaluating some strategies that would monitor one instrument for signals for entries and exits but place the trades on another separate instrument.
i was told to use the adddataseries() command and i have managed to get some basic strategies to work as desired. however, i have also tried some minor modifications so that inputs like the contract month and interval size would not have to be hard coded in the strategies but could be modified as inputs and these changes have caused the strategies to stop working.
i have used the strategy builder to add two data series to my strategies and this fragment works without problem:
Minutes = 5;
}
else if (State == State.Configure)
{
AddDataSeries("6E 03-19", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
AddDataSeries("M6E 03-19", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
}
if i try this modification below, the strategy will compile but then it won't make any trades:
Minutes = 5;
}
else if (State == State.Configure)
{
AddDataSeries("6E ##-##", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
AddDataSeries("M6E ##-##", Data.BarsPeriodType.Minute, 5, Data.MarketDataType.Last);
}
¿is there any way to properly use continuous contracts with the adddataseries() command so that it wouldn't be necessary to change the code every time a contract expires?
i have also tried to make the interval size an input so that the strategy could be adjusted easily from the strategy analyzer and even optimized on that parameter. when i try this structure below the strategy will verify but once again it won't place any trades:
Minutes = 5;
}
else if (State == State.Configure)
{
AddDataSeries("6E 03-19", Data.BarsPeriodType.Minute, Convert.ToInt32(Minutes), Data.MarketDataType.Last);
AddDataSeries("M6E 03-19", Data.BarsPeriodType.Minute, Convert.ToInt32(Minutes), Data.MarketDataType.Last);
}
¿is it possible to have the bar size for additional data series as an input and not hardcoded in the strategy itself?
very well, thanks, regards.
Comment