I found a serious bug (?):
ArraySort( pbuffer );
code drops 'pbuffer' - parameter conversion is not allowed Levels.mq5 106 16
ArraySort() only works for one dimension arrays. This makes sense, since with a 2D array it is not known what criterion should be used to declare that a whole row of numbers is greater or lesser than another row.
The ArrayObj class in the standard library could be used to define a 2D array that could be sorted.