How can I do a similar thing to do the same function?
If in the GUI, I select 30 min chart, I want to add 30 min, 15 min and 10 min data streams.
If in the GUI, I select 15 min chart, I want to add 15 min, 10 min and 5 min data streams.
#region Initialize
///<summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
///</summary>
protectedoverridevoid Initialize()
{
EntryHandling = EntryHandling.UniqueEntries;
AllowRemovalOfDrawObjects = true; // Draw objects can be removed separately from the script
// add the data series to calc on
// Add(PeriodType.Minute, intraPeriodInMinutes);
if (BarsPeriods[0].Id == "Day" && BarsPeriods[0].Value == "1")
{
Add(PeriodType.Day, 1);
Add(PeriodType.Minute, 30);
Add(PeriodType.Minute, 15);
}
// else if (BarsPeriods[0].Id == "Minute" && BarsPeriods[0].Value == "30")
// {
// Add(PeriodType.Minute, 30);
// Add(PeriodType.Minute, 15);
// Add(PeriodType.Minute, 5);
// }
// else if (BarsPeriods[0].Id == "Minute" && BarsPeriods[0].Value == "15")
// {
// Add(PeriodType.Minute, 15);
// Add(PeriodType.Minute, 10);
// Add(PeriodType.Minute, 5);
// }
// else if (BarsPeriods[0].Id == "Minute" && BarsPeriods[0].Value == "10")
// {
// Add(PeriodType.Minute, 10);
// Add(PeriodType.Minute, 5);
// Add(PeriodType.Minute, 2);
// }
// Calculate on the close of each bar = false - we will be using intraday data
CalculateOnBarClose = false;
}
#endregion

Comment