There are lots of ways to go about this: the Custom Movement behavior isn't meant to recreate behaviors like this, as noted on the Custom Movement manual page, and would be best suited for other behaviors, or simply using the Move at Angle command or Bullet behavior with an event to round its angle to 45, 135, 225, or 315. Custom Movement just doesn't give you the capabilities you need.
Yet if you really want to check for when the ball collides with a corner, (or moves through it, as happened to me when I tested out your .capx,) you should add another event to check for when the ball X/Y is exactly at wall X/Y or inside of it to check for the corner and multiply the custom movement speed by -1 rather than using the reverse function.