{
CalculateOnBarClose = true;
ExitOnClose = false;
BarsRequired = 0;
Add(PeriodType.Day,1); //Add 1 day bar
}
protected override void OnBarUpdate()
{
if(BarsInProgress == 0) //Primary bar
Print("1minbar "+CurrentBar.ToString());
if(BarsInProgress == 1) //The added 1day bar
Print("1daybar "+CurrentBar.ToString());
}
Output:
1daybar 1
1minbar 1146
1minbar 1147
1minbar 1148
1minbar 1149
1minbar 1150
...
Why doesn't the 1min bar start at 1 ? instead of 1146. That means if I want to buy/sell on the min bar I need to wait for bar 1146. How is that acceptable ??
If I remove the add() statement I get
1minbar 1
1minbar 2
1minbar 3
1minbar 4
1minbar 5
...
As expected
Comment