![]() |
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
|
One of my multi-timeframe scripts suddenly started throwing an error, and lost its plot, after I updated to NT 7.0.1000.9, on my development NT box. The log showed an index-access error, so I decided to investigate by setting up a new chart with the exact same timeframe parameters on my compilation NT 7.0.1000.8 box (which I had not yet updated). Much to my surprise, the problem does seem version specific.
To illustrate the problem, I have included an indicator file, which loads a secondary SPY BarSeries. (The name of the file is a question, not a statement ).Here is the replication scenario.
On a NT7.0.1000.9 box, you will see numerous exceptions in the output window, followed by correct output. This is not just a demo problem. It did break a shipping indicator of mine, as the shipping indicator does not use Try/Catch blocks. The only reason we finally start to get valid output is because the exceptions are caught and thrown; hardly a recipe for good product. NT 7.0.1000.8 produces absolutely clean output, with no exceptions. I can post the 2 outputs if you wish to see them. |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,858
Thanks: 162
Thanked 579 times in 570 posts
|
Thanks for reporting Koganam,
I was not able to reproduce immediately. When testing on a R9 setup, I receive the following output: Code:
CurrentBar: 0 BarsArray[0]: -- instrument='DIA' from='2012-02-15' to='2012-02-20' period=5 Min splitAdjusted=False dividendAdjusted=False bars=328 BarsArray[1]: -- instrument='SPY' from='2012-02-15' to='2012-02-20' period=5 Min splitAdjusted=False dividendAdjusted=False bars=541 Current Value of 1st BarsData: 128.57 at 2/15/2012 2:05:00 AM Current Value of 2nd BarsData: 135.95 at 2/15/2012 2:05:00 AM Can you please post the output from the two installations?
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#3 | |
|
Senior Member
|
Quote:
I have no objection if you want to remote in to look at the machine. It is a bit heavy on applications installed, as it is a development machine, but I run this test with nothing else beyond the startup programs running. |
|
|
|
|
|
|
#4 | |
|
Senior Member
Join Date: Aug 2010
Location: Washington, D.C.
Posts: 1,267
Thanks: 192
Thanked 332 times in 287 posts
|
Quote:
I got it until 9:35 am? I changed to 10 days and just about the same thing happened in NT 7-8 (the error started earlier, then it cleared up , and was fine by the 5 day data load issues). |
|
|
|
|
|
|
#5 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,858
Thanks: 162
Thanked 579 times in 570 posts
|
Koganam,
I was able to reproduce this today on both R8 and R9. I was also able to resolve by adding a currentbars check: Code:
if(CurrentBars[0] < 1)
return;
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#6 | |
|
Senior Member
|
Quote:
There was never an access to a past bar, so there should not ever have been an index error in the first place. The access was always to bar[0], so escaping the first bar seems to be rather a slapshot attempt to see what happens? ![]()
|
|
|
|
|
|
|
#7 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,858
Thanks: 162
Thanked 579 times in 570 posts
|
Hello,
This can be generated if OnBarUpdate was attempted to run on an added series where there was no data to work from. Using a check of CurrentBars[0] < 0 would prevent this as well and is not necessarily related to accessing a past index value.
Matthew
NinjaTrader Customer Service |
|
|
|
|
|
#8 | ||
|
Senior Member
|
Quote:
Quote:
|
||
|
|
|
|
|
#9 |
|
NinjaTrader Customer Service
Join Date: Apr 2010
Location: Denver, CO, USA
Posts: 4,858
Thanks: 162
Thanked 579 times in 570 posts
|
Right - it wouldn't matter which series was being called, the exception is just saying that that bar didn't exist when OnBarUpdate was running. When the first bar of BarsArray[0] was updating, there was no BarsArray[1]. Added a check for CurrentBars then returning will allow for the BarsArray to complete before the rest of the script is ran.
Matthew
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| NT7.1000.1 and NT7.1000.3 compiler difference | pbcah | Indicator Development | 9 | 02-24-2011 03:33 PM |
| NT7 - Mulit-timeframe multi-instrument protective orders | Shansen | Strategy Development | 2 | 10-30-2010 05:01 AM |
| Multi-timeframe strategy skips lower timeframe bars at one point | adamus | Version 7 Beta General Questions & Bug Reports | 13 | 07-03-2010 01:36 AM |
| NT7 clarification - Multi timeframe strategy | Shansen | Version 7 Beta General Questions & Bug Reports | 1 | 04-08-2010 07:32 AM |
| Multi-Time Frame Processing Question | tazatek | Strategy Development | 5 | 04-06-2010 11:24 AM |