NexusFi: Find Your Edge


Home Menu

 





MACD Arrows - glitch


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Slipknot511 with 4 posts (1 thanks)
    2. looks_two Fat Tails with 2 posts (4 thanks)
    3. looks_3 Big Mike with 1 posts (0 thanks)
    4. looks_4 vegasfoster with 1 posts (1 thanks)
      Best Posters
    1. looks_one Fat Tails with 2 thanks per post
    2. looks_two vegasfoster with 1 thanks per post
    3. looks_3 sharmas with 1 thanks per post
    4. looks_4 Slipknot511 with 0.3 thanks per post
    1. trending_up 5,639 views
    2. thumb_up 7 thanks given
    3. group 1 followers
    1. forum 9 posts
    2. attach_file 3 attachments




 
Search this Thread
  #1 (permalink)
 
Slipknot511's Avatar
 Slipknot511 
Springfield,Missouri, USA
 
Experience: Advanced
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.


Attached Files
Elite Membership required to download: MACDScalpArrow.zip
Elite Membership required to download: MACDScalpArrow Explanation.txt
Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Topstep Acquires The Futures Desk -- Prop Firm Consolida …
Funded Trading Evaluation Firms
Iran Update May 8: Still Reviewing MOU, Demands Reparati …
Traders Hideout
The May 31 Binary: 60% Trump Declares Iran Ops Over, Onl …
Prediction Markets & Event Contracts
February NFP Preview -- Why This Mornings Jobs Number Co …
Traders Hideout
Kharg Island at 6%, Regime Fall at 1.5% -- The Black Swa …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
23 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


If you access Stochastics(8, 3, 3).K[2] for CurrentBar = 1, this is not defined, so you may run into problems. Not tested.


Reply With Quote
Thanked by:
  #4 (permalink)
 
Slipknot511's Avatar
 Slipknot511 
Springfield,Missouri, USA
 
Experience: Advanced
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?


Started this thread Reply With Quote
  #5 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557

Tip
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.



Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 845


Slipknot511 View Post
I have the "Maximum bars look back" set to infinite, but that doesn't fix anything.
Any ideas?


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.


Reply With Quote
Thanked by:
  #7 (permalink)
 
Slipknot511's Avatar
 Slipknot511 
Springfield,Missouri, USA
 
Experience: Advanced
Platform: NinjaTrader (It's a love/hate relationship)
Trading: CL, TF, 6E
Posts: 169 since May 2010
Thanks Given: 60
Thanks Received: 314


vegasfoster View Post
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.

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.


Started this thread Reply With Quote
  #8 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114

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.

https://forum.ninjatrader.com/showthread.php?p=205168


Attached Files
Elite Membership required to download: MACDScalpArrow.cs
Reply With Quote
Thanked by:
  #9 (permalink)
 sharmas 
Auckland
Market Wizard
 
Experience: Advanced
Platform: Ninja Trader
Broker: Zen-Fire
Trading: CL and ES
Posts: 783 since Apr 2010
Thanks Given: 3,830
Thanks Received: 752

Fat Tails

You are a true LEGEND.

You amaze me with your kindness and dedication.

We are so very fortunate to have you.

Thank you for everything you have done and doing for us.

sharmas


Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #10 (permalink)
 
Slipknot511's Avatar
 Slipknot511 
Springfield,Missouri, USA
 
Experience: Advanced
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.


Started this thread Reply With Quote




Last Updated on November 19, 2010


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts