NinjaTrader Support Forum  
X

Attention!

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


Go Back   NinjaTrader Support Forum > Application Technical Support > Miscellaneous Support

Miscellaneous Support Miscellaneous support issues.

Reply
 
Thread Tools Display Modes
Old 03-10-2008, 05:38 AM   #1
altrader
Member
 
Join Date: Mar 2008
Posts: 49
Thanks: 0
Thanked 0 times in 0 posts
Default OnBarUpdate() - never seems to be called?

In my strategy the OnBarUpdate method seems to never be called (I have some lines of code in there to print text to the output window so I can see what's happening). The indicators appear on the chart but nothing else seems to happen.

How can I debug this? I don't understand why it's never being called and I don't know how to start stepping through the code to see why it's never been called? It compiles correctly.

Can anyone help?

Thanks
altrader is offline  
Reply With Quote
Old 03-10-2008, 06:14 AM   #2
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

a) are you talking about a custom indicator or a custom strategy?
b) how does "The indicators appear on the chart" relate?
c) are there any funny messages in the logs?
NinjaTrader_Dierk is offline  
Reply With Quote
Old 03-10-2008, 06:31 AM   #3
altrader
Member
 
Join Date: Mar 2008
Posts: 49
Thanks: 0
Thanked 0 times in 0 posts
Default

This is a custom strategy.
I add some indicators to the chart in the initialize method, so I can see that part is working ... it just never seems to get into OnBarUpdate after that.
I'm sure I checked the log screen and didn't see any strange messages. However .. have just looked in the files contained in C:\EMC\NinjaTrader 6.5\log and see the following 09/03/2008 17:35:22|3|128|Failed to call method 'Initialize' for strategy 'TestStrategy': 'Bars' property can not be accessed from within 'Initialize' method.

But I did see the indicators on the chart ... and they're in the initialize method.

Sorry, this is my first foray into NT - Apologies if I have made a schoolboy error somewhere?
altrader is offline  
Reply With Quote
Old 03-10-2008, 06:32 AM   #4
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

You can not access the "Bars" property in the Initialize method of your strategy.
NinjaTrader_Dierk is offline  
Reply With Quote
Old 03-10-2008, 07:05 AM   #5
altrader
Member
 
Join Date: Mar 2008
Posts: 49
Thanks: 0
Thanked 0 times in 0 posts
Default

As far as I'm aware I'm not trying to access the Bars property in my initialize method.
The only thing that I see is Add(PeriodType.Minute, 60); //BarsArray[1]
but BarsArray is commented out?

I can't test this at the moment but when I can is there anyway I can find out what line of code is causing this problem?

thanks
altrader is offline  
Reply With Quote
Old 03-10-2008, 07:09 AM   #6
NinjaTrader_Dierk
Administrator
 
NinjaTrader_Dierk's Avatar
 
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
Default

This is a good starting point for debugging: http://www.ninjatrader-support.com/v...ead.php?t=3418
NinjaTrader_Dierk 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
Is a function calculated each time when it is called? FireFly General Programming 3 12-26-2007 01:09 PM
What is the method called for closing positions? tomiboi Strategy Development 1 12-14-2007 03:43 AM
OnBarUpdate from different datafeeds sergioloff Strategy Development 2 10-29-2007 02:34 PM
Stateful OnBarUpdate kgillis23 General Programming 2 05-30-2007 11:01 AM
Is there a counterpart of Initialize, called when strategy is stopped? californiaruby Automated Trading 2 02-20-2007 03:39 AM


All times are GMT -6. The time now is 05:11 PM.