NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Sunday May 26th at 12PM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 04-04-2010, 09:54 AM   #1
tazatek
Senior Member
 
Join Date: Jul 2008
Location: Grand Junction, CO
Posts: 148
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to tazatek
Default Multi-Time Frame Processing Question

Question: Is there a guaranteed order in which the Bars Objects will be called?

ie.

if I have a 1 minute primary, a 2 minute and a 3 minute (indices of 0,1,2 respectively)

When onBarUpdate() is called, can I rest assured that the indices will be called in the same order that they are added?

so first I'll evaluate my 1 minute, then my 2 minute and lastly my 3 minute bar object?


And is this true for both indicators and strategies?


Thanks

Matt
tazatek is offline  
Reply With Quote
Old 04-04-2010, 01:17 PM   #2
NinjaTrader_Austin
NinjaTrader Customer Service
 
NinjaTrader_Austin's Avatar
 
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
Default

Matt, I will have someone get back to you tomorrow regarding this question.
NinjaTrader_Austin is offline  
Reply With Quote
Old 04-06-2010, 06:23 AM   #3
tazatek
Senior Member
 
Join Date: Jul 2008
Location: Grand Junction, CO
Posts: 148
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to tazatek
Default

Quote:
Originally Posted by NinjaTrader_Austin View Post
Matt, I will have someone get back to you tomorrow regarding this question.
Do we have an answer to this... Print statements show that things are fairly random....

Would like to know what behaviors I can (or can't) expect from this....

Thanks

MAtt
tazatek is offline  
Reply With Quote
Old 04-06-2010, 07:02 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

Matt, the bars objects get called in the sequence they're added - if you have bars with the same timestamp, they are also processed in the original added order, please also check into this sample below -

http://www.ninjatrader-support2.com/...ead.php?t=6652
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 04-06-2010, 10:26 AM   #5
tazatek
Senior Member
 
Join Date: Jul 2008
Location: Grand Junction, CO
Posts: 148
Thanks: 0
Thanked 0 times in 0 posts
Send a message via Skype™ to tazatek
Default

Just to be clear....

If I have a primary that is 1 min, and I add() a 2 min in initialize,

Then in OnBarUpdate() I have

Code:
{

if(BarsInProgress==0)
{
// should print out twice ... 
Print("BIP 0");
}
else if(BarsInProgress==1)
{
// should print out once...
Print("BIP 1");
}
I should ALWAYS have in my output (in this order):
BIP 0
BIP 0
BIP 1

I'm just wanting to make sure that it can't ever be:

BIP 1
BIP 0
BIP 0

or
BIP 0
BIP 1
BIP 0


Thanks

Matt
tazatek is offline  
Reply With Quote
Old 04-06-2010, 11:24 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
Default

You're understanding is correct, for easier checking you could also use PrintWithTimeStamp -

Code:
 protected override void OnBarUpdate()
		{
			if (BarsInProgress == 0)
				PrintWithTimeStamp("BIP0");
			
			if (BarsInProgress == 1)
				PrintWithTimeStamp("BIP1");
		}
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multi Time Frame plotting question gyoung Version 7 Beta General Questions & Bug Reports 5 03-18-2010 02:08 PM
Multi Time Frame strategy/indicator question gyoung Version 7 Beta General Questions & Bug Reports 8 01-18-2010 12:48 PM
Multi Time Frame PSAR question kgillis23 Strategy Development 5 03-12-2008 10:43 PM
multi time frame question pdawg Strategy Analyzer 5 10-18-2007 02:23 PM
Basic multi-time frame question jonesr227 Strategy Development 8 08-26-2007 03:24 PM


All times are GMT -6. The time now is 06:22 PM.