Im trying to calculate 10 day average daily range of regular trading hour from daily bar but not sure how to do it.
protected override void Initialize()
{
Add(PeriodType.Day, 1);
}
protected override void OnBarUpdate()
{
if (BarsInProgress == 1)
{
averageRange = SMA(Range(),10)[0];
Print(Time[0].ToString());
Print("averageRange of 10 days is "+averageRange.ToString());
}
}
As you can see below output, all the calculations are starting from default session time...
How would I need to do so Range calculation is done base only on RTH 6:30-1:15 PST.
Is this possible? any suggestion?
Any help would be appreciated.
Output:
9/24/2007 12:00:00 AM
averageRange of 10 days is 156.5
9/25/2007 12:00:00 AM
averageRange of 10 days is 150.285714285714
9/26/2007 12:00:00 AM
averageRange of 10 days is 145.75
9/27/2007 12:00:00 AM
averageRange of 10 days is 138.888888888889
Comment