Is it possible that Custom Array is greater than Barcount

When I loop through the ticker (from 0 to barcount -1) to create an array, my custom array is greater than the barcount so given the error “Array subscript out of range…”. To fix this, I have to manually change the starting bar of the loop (from some bar to barcount-1).

  • Is it possible to define the size or extend the number of bars?
  • is there any way to overcome this?
    Please help, Thanks.

That error is thrown when you are trying to access an array element outside the range.


Value = MyArray[i - 1]; // will try and access element # -1, ie below zero
Value = MyArray[i + 1]; // will try and access element after Barcount - 1

Check your code on the line indicated by the error.

If you’re still stuck, post the code here (remembering to format it as stated in the page header)

1 Like

Arrays have fixed size because they are all aligned to datetime-stamps of currently selected symbol so they represent price series, where each array element represents ‘bar’

But for freely-sized vectors you can use vertical or horizontal (1D) Matrix.

1 Like

Thanks Helix,
I aware of that, but my problem is when I try to create point and figure chart the column is greater than bar numbers.
Eg, Ticker have 200 bars, and P&F chart has more than 200 columns.

Thanks Tomasz,
It’s clear for me now. I’ll try to work with the matrix.

1 Like