I understand from the manual under "bars" that a totally wrong bar period will result in not enough allocated bars. I dont know what consequences that has on prices but suppose that many things will then not work.

You code seems to allow the renko bars to have a multiple of their bar range, are you sure this is correct? I always thought that Renko bars must not exceed their bar range.