![]() |
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
|
|||||||
| Miscellaneous Support Miscellaneous support issues. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Aug 2008
Location: Orlando, Florida
Posts: 166
Thanks: 0
Thanked 0 times in 0 posts
|
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;
}
|
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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.
Ray
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Aug 2008
Location: Orlando, Florida
Posts: 166
Thanks: 0
Thanked 0 times in 0 posts
|
I am getting the following error...
"Error on calling 'OnBarUpdate' method for strategy 'MyStrategy': Object reference not set to an instance of an object." |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
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
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |