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 > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 10-22-2010, 03:14 AM   #1
drolles
Senior Member
 
Join Date: Mar 2009
Posts: 292
Thanks: 12
Thanked 1 time in 1 post
Default Bars.GetDayBar(1).Time returning null

Dear NT Support,

I’ve solved the problem, but just in interest of all NT users and yourselves I thought I best post here.

I’ve just been working with GetDayBar. It had been returning null exceptions.

It was returning null exceptions. I’m running a multi-timeframe strategy with a focus on 60min charts with a secondary focus (i.e. Add(PeriodType.Minute, 1) of 1 min. GetDayBar was returning null when I was using it to track dates (i.e. currentDate = Bars.GetDayBar(1).Time). This would continue to return null object exceptions. However, when I added a third timeframe (i.e. Add(PeriodType.Day, 1)) the strategy ran fine and returned expected results.

Are we required to have a “Day” timeframe for GetDayBar to operate correctly? Is that expected behaviour?

Thanks and regards,

drolles
drolles is offline  
Reply With Quote
Old 10-22-2010, 03:25 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

drolles, checking for null is advised when working with GetDayBar, as it could return null if there's not enough intraday data to build the virtual daily bar, so as you added the native daily series this was resolved - http://www.ninjatrader.com/support/h.../getdaybar.htm
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 10-22-2010, 05:00 AM   #3
drolles
Senior Member
 
Join Date: Mar 2009
Posts: 292
Thanks: 12
Thanked 1 time in 1 post
Default

Bertrand,

Thank for the prompt reply.

I was setting the Min Bars Required up to 80 – 100 (of 60 min bars) that is not enough to fill the indicator? That is nearly a weeks worth of data.

What would be in the min required?

Thanks and regards,

drolles
drolles is offline  
Reply With Quote
Old 10-22-2010, 06:01 AM   #4
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
Default

MinBarsRequired would mean how many bars for each series need to be present in order to call the OnBarUpdate() - so with this high setting you prevented the idea from working - how many days back of data were you loading?
NinjaTrader_Bertrand is offline  
Reply With Quote
Old 10-22-2010, 07:51 AM   #5
drolles
Senior Member
 
Join Date: Mar 2009
Posts: 292
Thanks: 12
Thanked 1 time in 1 post
Default

Bertrand,

Thanks for your reply.

Your question was thought provoking so I’ve done some testing around this now.

I set the Min Bars Required to 20, again with 60 min bars as target timeframe with secondary timeframe of 1 min bars.

I’ve just got NT7 to crash backtesting my strategy.

Sequence of events:

1. Backtested on 2010 data (to date i.e. 22/10/2010) not connected to Esignal – backtestested fine
2. Restarted NT7
3. Backtested on 2010 data (to date i.e. 22/10/2010) not connected to Esignal – received Object exception message
4. Backtested on 2009 data not connected to Esignal – backtested fine
5. Connected to Esignal
6. Backtested on 2010 data connected to Esignal – NT7 said loading missing data items – crashed

Hope this helps with the beta.

Kind regards,

Dan
drolles is offline  
Reply With Quote
Old 10-22-2010, 10:31 AM   #6
NinjaTrader_Josh
NinjaTrader Product Manager
 
NinjaTrader_Josh's Avatar
 
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
Default

Can you please provide us with your complete log/traces? Thank you.

Can you please provide us with the strategy you are using as well so we can see how exactly it is programmed? Thanks.
NinjaTrader_Josh is offline  
Reply With Quote
Old 10-22-2010, 10:53 PM   #7
drolles
Senior Member
 
Join Date: Mar 2009
Posts: 292
Thanks: 12
Thanked 1 time in 1 post
Default

Josh,

No problem.

I have forwarded the log file referencing this thread. Unfortunately, I don’t think it is appropriate that I post the strategy here.

I hope it helps the beta development.

Kind regards,

Dan
drolles is offline  
Reply With Quote
Old 10-23-2010, 02:26 PM   #8
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

Thank you, Dan.
NinjaTrader_Austin is offline  
Reply With Quote
Old 01-16-2011, 01:59 PM   #9
devdas
Junior Member
 
Join Date: Feb 2010
Posts: 13
Thanks: 1
Thanked 1 time in 1 post
Default

@drolles

I had similar problem in one of Indicator coding.

Later i realised it depends on Instrument's Session template.
It was mismatching of Session template that causing Null return, that i could correct with correct session template.

Hope it helps.
devdas is offline  
Reply With Quote
Old 01-18-2011, 02:42 AM   #10
drolles
Senior Member
 
Join Date: Mar 2009
Posts: 292
Thanks: 12
Thanked 1 time in 1 post
Default

Devdas,

Thanks for letting me know and the pointer towards the session template. I've not seen the problem for a while, but this is good for reference.

Kind regards,

drolles
drolles 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
Instrument.MasterInstrument.Name returning null firewlae Indicator Development 1 11-28-2009 10:35 AM
Plots and Null Value TAJTrades General Programming 2 05-12-2009 05:28 AM
Returning Trade Entry Time TAJTrades General Programming 1 11-25-2008 04:41 PM
Bars == NULL oferr Strategy Analyzer 4 01-31-2008 07:57 AM
Testing for null zoltran General Programming 7 11-25-2007 05:09 PM


All times are GMT -6. The time now is 11:40 AM.