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 > Application Technical Support > Miscellaneous Support

Miscellaneous Support Miscellaneous support issues.

Reply
 
Thread Tools Display Modes
Old 08-20-2008, 10:20 AM   #1
SystemTrading
Senior Member
 
Join Date: Aug 2008
Location: Orlando, Florida
Posts: 166
Thanks: 0
Thanked 0 times in 0 posts
Default OnBarUpdate

The following code only executes once when I initialize the strategy. Afterwards, I get nothing. I would like to see the code Print "OBU" on each tick. What would be the reason this isn't working?

Code:
protectedoverridevoid Initialize()
{
CalculateOnBarClose = false;
// TraceOrders = true;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{ 
Print("OBU");
if (Historical)
return;
}

SystemTrading is offline  
Reply With Quote
Old 08-20-2008, 10:25 AM   #2
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Any error messages in the Log tab?

Provided that you have enough bars on your chart when you are running the strategy (make sure Min bars requires is set to 20 --> You could try setting to 1 to check) it will print. to the Output window.
NinjaTrader_Ray is offline  
Reply With Quote
Old 08-20-2008, 10:29 AM   #3
SystemTrading
Senior Member
 
Join Date: Aug 2008
Location: Orlando, Florida
Posts: 166
Thanks: 0
Thanked 0 times in 0 posts
Default

I am getting the following error...

"Error on calling 'OnBarUpdate' method for strategy 'MyStrategy': Object reference not set to an instance of an object."
SystemTrading is offline  
Reply With Quote
Old 08-20-2008, 10:38 AM   #4
NinjaTrader_Ray
Administrator
 
NinjaTrader_Ray's Avatar
 
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
Default

Thanks, that would explain why you don't see anything. Somewhere in your strategy you have a logic error that causes this exception which terminates the strategy.

Here is a a tip we wrote up to help guide you to resolution.

http://www.ninjatrader-support.com/v...ead.php?t=4226
NinjaTrader_Ray 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
Indicator's OnBarUpdate() is called twice mgbloomfield Automated Trading 1 04-20-2008 12:07 AM
OnBarUpdate() - never seems to be called? altrader Miscellaneous Support 5 03-10-2008 07:09 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
Events Other Than OnBarUpdate californiaruby Automated Trading 5 02-10-2007 08:30 AM


All times are GMT -6. The time now is 02:41 AM.