These lines are the (same) problem (array indexing):
1) Why is `double X;` Wrong?
2) What am I doing wrong with the array indexing?
There's a lot to unpack here... First, you should not be resizing the indicator buffers because the platform does that automatically behind the scenes. Next, you're specifying a statically allocated matrix to be used as a dynamic buffer, which will not work. You can create objects which contain dynamic double arrays which you can register as a buffer, however, since you're still learning, it'd be best to stick with the simple method of defining individual arrays for each buffer. Furthermore, regarding the use of multiple handles and matrices, you should avoid multi-dimensional arrays unless you absolutely need them for matrix maths. MQL has high-level abstractions for your use-case that removes the hackish ambiguity of matrices when you really need OOP. Have a look at the CIndicators library and use CiMA with a CIndicators collection.
This is my current solution: https://gist.github.com/Industrial/f5604706da6df65839fabf086d4e8290
I made individual buffers. I'm still not pleased with this. In another language I'd have easily made an objector array and stuck them in there, so I could have a dynamic amount of buffers/arrays.
I'm no longer doing the Array resizing but right now I do have a big ugly switch statement in a for loop in order to only calculate/paint the amount of lines required.
I currently have no use for matrices.