Your interactive trading laboratory!
 • 
8 users online

Execute Exception (TQQQ,1758) Index was out of range...

I'm getting a new exception, right at the very end of a backtest:

Execute Exception (TQQQ,1758) Index was out of range. Must be non-negative and less than the size of the...

and then it cuts off (can't read more). Everything in the backtest finishes (viewers all filled, debug log completes) except that the Positions List viewer shows the currently open trade (TQQQ bought May 8 at mkt open) as closed on May 8 (only supposed to be closing on market opens, so if it was really closed it should have closed this morning, May 9).

It does the same thing with other symbols. There are no compilation errors, just this at the end of the backtest. Ideas what I've done wrong? My strategy looks at a bunch of short signals to go long SQQQ but if none of them are active it goes long TQQQ, so I'm wondering if maybe my code messes up somehow on the transactions? But the meaning and source of this exception message aren't very clear.

Attachment

Cancel

Responses

I was future peeking [index + 1] in a debug statement :-) So it complains when it gets to the last bar which doesn’t exist yet.

I was future peeking [index + 1] in a debug statement :-) So it complains when it gets to the last bar which doesn’t exist yet.

OK glad you were able to solve it! :)

OK glad you were able to solve it! :)
Forum Tips

Please sign in if you want to participate in our forum.

Our forum uses Markdown syntax to format posts.

To embed code snippets, enclose them in [CODE][/CODE] tags.