I was able to work around this error by switching from 1 minute to 5 minute candles..
Still haven't found a way to make it work with 1 minute candles and larger than 4000 historysize.
Still haven't found a way to make it work with 1 minute candles and larger than 4000 historysize.