I'm trying to add a daily series for strategy using multi-instruments. I'm using a loop to display in the output window the results of the historical data. It does not seem to be working when I ask for daily bars.
Add ("YM 09-10", PeriodType.Day, 1);
I use the following code to display the data for me.
protected override void OnBarUpdate()
for (int x = 0; x < 21; x++)
{
Print("In for Loop " + x);
Print (Closes[2][x] + " " + Times[2][x]);
}
This is the output I get when I try to load and print daily bars
In for Loop 0
10141 6/14/2010 12:00:00 AM
In for Loop 1
NT seems to freeze here after the last print. Although I don't have to quit NT, I just stop the strategy and everything seems to work OK.
However, when I change the ADD to minute bars, things seem to work well.
Add ("YM 09-10", PeriodType.Minute, 1);
Here's the output:
In for Loop 0
10084 6/28/2010 4:51:00 PM
In for Loop 1
10090 6/28/2010 4:49:00 PM
In for Loop 2
10085 6/28/2010 4:48:00 PM
In for Loop 3
10082 6/28/2010 4:47:00 PM
In for Loop 4
10082 6/28/2010 4:46:00 PM
In for Loop 5
10084 6/28/2010 4:45:00 PM
In for Loop 6
10083 6/28/2010 4:44:00 PM
In for Loop 7
10079 6/28/2010 4:43:00 PM
In for Loop 8
10079 6/28/2010 4:42:00 PM
In for Loop 9
10072 6/28/2010 4:41:00 PM
In for Loop 10
10072 6/28/2010 4:40:00 PM
In for Loop 11
10078 6/28/2010 4:39:00 PM
In for Loop 12
10080 6/28/2010 4:38:00 PM
In for Loop 13
10080 6/28/2010 4:37:00 PM
In for Loop 14
10081 6/28/2010 4:36:00 PM
In for Loop 15
10082 6/28/2010 4:35:00 PM
In for Loop 16
10081 6/28/2010 4:34:00 PM
In for Loop 17
10081 6/28/2010 4:33:00 PM
In for Loop 18
10080 6/28/2010 4:32:00 PM
In for Loop 19
10081 6/28/2010 4:31:00 PM
In for Loop 20
10088 6/28/2010 4:15:00 PM
A few questions:
1) Why does daily not work, it seems to load only 1 day pretty far back in the past? I expect to get the most recent close first, then earlier closes.
2) How can I control which data is loaded historically, i.e. can I load just regular trading hours and not extended? Can I have a data series with both regular and extended trading hours for the same security?
3) The strategy seems to freeze if I attempt calculations on a bar with no data. How can I check for data before running the calcs?
4) How can I increase the number of bars loaded?
Thanks for your help! I am using NT 6.5 on windows 7 64 bit.


Comment