NexusFi: Find Your Edge


Home Menu

 





Need help - Index was outside the bounds of the array Error Message


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one ECI Ed with 2 posts (0 thanks)
    2. looks_two cory with 1 posts (2 thanks)
    3. looks_3 vegasfoster with 1 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 4,527 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 4 posts
    2. attach_file 1 attachments




 
Search this Thread
  #1 (permalink)
ECI Ed
Seminole, FL
 
Posts: 17 since Oct 2011
Thanks Given: 9
Thanks Received: 3

The attached indicator compiles, but when I try to run it I get the following error message in my log file and cannot use a print statement to get to the bottom of the problem. Can someone please help get on the right track for troubleshooting this?

Error on calling 'OnBarUpdate' method for indicator 'SMIwDiv' on bar 0; Index was outside the bounds of the array.

Thanks in advance.


Attached Files
Elite Membership required to download: SMIwDiv.cs
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Tradestation Chart Setup
TradeStation
how to attach stop order to trend line made to look like …
NinjaTrader
Forex Factory News - Weekly XML Export
Traders Hideout
Is NinjaTrader moving away from a user-centered platform?
NinjaTrader
Serious Accountability Partner or Trading Pod
Emini and Emicro Index
 
  #3 (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: 844


Maybe try changing to,

if (FirstTickOfBar && sMI != 0 || CurrentBar <= lb ) {


Reply With Quote
Thanked by:
  #4 (permalink)
ECI Ed
Seminole, FL
 
Posts: 17 since Oct 2011
Thanks Given: 9
Thanks Received: 3

vegasfoster wrote: Maybe try changing to,

if (FirstTickOfBar && sMI != 0 || CurrentBar <= lb ) {

I think the preceeding instruction solves your concern, but just to make sure, I did try changing this line to
"if (FirstTickOfBar && (sMI != 0 || CurrentBar<=lb))" because this is the only way it makes sense, and it didn't solve the problem. I still get the error message.


Reply With Quote
  #5 (permalink)
 
cory's Avatar
 cory 
virginia
the coin hunter
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,093


ECI Ed View Post
The attached indicator compiles, but when I try to run it I get the following error message in my log file and cannot use a print statement to get to the bottom of the problem. Can someone please help get on the right track for troubleshooting this?

Error on calling 'OnBarUpdate' method for indicator 'SMIwDiv' on bar 0; Index was outside the bounds of the array.

Thanks in advance.

you number them wrong, don't count plots and lines together; count plots together, count lines together starting from 0. So they should be
------------
Lines[0].Pen = new Pen(Color.Red, 2);
Lines[1].Pen = new Pen(Color.Red, 2);
Lines[2].Pen = new Pen(Color.Gray, 2);
---------------


Reply With Quote
Thanked by:




Last Updated on June 30, 2013


© 2025 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