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)
Need help - Index was outside the bounds of the array Error Message
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.
Can you help answer these questions from other members on NexusFi?
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.
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);
---------------