Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Platform: NinjaTrader (It's a love/hate relationship)
Trading: CL, TF, 6E
Posts: 169 since May 2010
Thanks Given: 60
Thanks Received: 314
I'm having issues with an indicator that I use. I'm not a programmer and have no desire to be one, but I would like to see if anyone here can find and repair whatever is causing this indicator to not plot.
This indicator is not mine, but it is open source to the best of my knowledge. It is an MACD that plots arrows on the chart after a MACD/Average crossover, but also uses SMA and Stoch conditions before plotting.
The problem is that after using for a short while, this indicator will simply not plot after changing anything on the chart. It could be as simple as changing the instrument or days loaded that will cause it to glitch. Once it stops plotting, I have been unable to ever get it to plot again. I've tried everything from re-importing, re-booting Windows, and even re-installing NinjaTrader.
It is a fairly old indicator. Probably exported with NT6. It imports fine, compiles fine in both 6.5 and 7.
If anyone can discover why it is doing this and repair it, I'd be very grateful.
Attached is the indicator plus a txt file that accompanied it giving a decent description of how it works.
Platform: NinjaTrader (It's a love/hate relationship)
Trading: CL, TF, 6E
Posts: 169 since May 2010
Thanks Given: 60
Thanks Received: 314
Thanks for the reply, but I have no idea what that means. See if what I write below is relevant to what you are saying.
Update: It seems to have something to do with the amount of data. For example, if I plot a 6range chart, the indicator is OK as long as I don't have more than 2 days loaded. With a 15 minute chart, I can have 20 days.
I have the "Maximum bars look back" set to infinite, but that doesn't fix anything.
Any ideas?
Please post code in the [code](put code here)[/code] tags. When posting an entire indicator please add it as an attachment instead of pasting it into the body of your message.
I think that would make it worse. Unless the formula is looking back more than 256 bars, you want to set it at 256.
Fat is saying you need to edit the indicator and change If (Currentbar == 0) to If (Currentbar < fast + slow + smooth +20). For any indicator you want to return null or 0 when referencing a prior bar for initial periods in an amount greater than the longest period parameter length. The simplest thing is to add up all period parameters and add some margin of safety, e.g. 20, then you know you have your bases covered or you can just use some big number like a 100. Otherwise on bar 1 or bar 2 or whatever, the code it is looking for information in the past that does not exist on the chart and it gets confused.
Platform: NinjaTrader (It's a love/hate relationship)
Trading: CL, TF, 6E
Posts: 169 since May 2010
Thanks Given: 60
Thanks Received: 314
That did. Thanks much to Fat Tails for identifying the problem so quickly & thank-you vegasfoster for "putting the cookies on the bottom shelf" so even I could understand it.
Just quickly installed the indicator, toggled to CL and indicator disappeared.
This is the message shown in the trace file:
2010-11-19 22:54:53:593 ERROR: Error on calling 'OnBarUpdate' method for indicator 'MACDScalpArrow' on bar 1: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
This confirms exactly what I supposed.
If you are at bar 1 - which is the second bar of your chart - and you call a data series value two bars ago that would be the bar -1, which prior to the start of the chart. That creates an out-of range exception.
When I try to export the indicator this cannot be done, because the NinjaTrader Stochastics indicator has a bug. So what I suggest is that you simple copy the indicator attached below into your indicator directory open it from within NinjaTrader and compile it.
Here is the stochastics bug already confirmed, was not the first to discover it. Was the third new NinjaTrader bug that I found this week.
Platform: NinjaTrader (It's a love/hate relationship)
Trading: CL, TF, 6E
Posts: 169 since May 2010
Thanks Given: 60
Thanks Received: 314
Thank you very much. I copied and compiled and it works great.
How you could see that so easily is beyond me.
I don't use very many indicators, but this is one that I like. I really appreciate your help.