![]() |
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
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Mar 2009
Posts: 292
Thanks: 12
Thanked 1 time in 1 post
|
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 |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
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
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Mar 2009
Posts: 292
Thanks: 12
Thanked 1 time in 1 post
|
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 |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
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?
Bertrand
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Mar 2009
Posts: 292
Thanks: 12
Thanked 1 time in 1 post
|
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 |
|
|
|
|
|
#6 |
|
NinjaTrader Product Manager
Join Date: May 2007
Location: Denver, CO
Posts: 17,458
Thanks: 1
Thanked 106 times in 70 posts
|
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.
Josh
NinjaTrader Customer Service |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Mar 2009
Posts: 292
Thanks: 12
Thanked 1 time in 1 post
|
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 |
|
|
|
|
|
#8 |
|
NinjaTrader Customer Service
Join Date: Jun 2009
Location: Denver, CO
Posts: 3,149
Thanks: 10
Thanked 89 times in 81 posts
|
Thank you, Dan.
Austin
NinjaTrader Customer Service |
|
|
|
|
|
#9 |
|
Junior Member
Join Date: Feb 2010
Posts: 13
Thanks: 1
Thanked 1 time in 1 post
|
@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. |
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Mar 2009
Posts: 292
Thanks: 12
Thanked 1 time in 1 post
|
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 |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
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 |