I think you need to sit down and write a set of concrete rules before you give it to a programmer.
For example, you state
But in the image, the bar where you state a breakout high is created has a lower high than the first, second or third bars. So how is that a high breakout point ...