![]() |
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
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
|
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 |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
Matt, I will have someone get back to you tomorrow regarding this question.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
|
|
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
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
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
|
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");
}
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 |
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
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");
}
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |