I thought I had an idea for the formation, but it probably won't work because triggers don't pay attention to the formation
(I thought of creating a melee and ranged unit and let them do a very short race to a region - the thing is that the ranged unit would have a head-start. If formation is on, the ranged unit would be last because he would wait for the melee unit to pass first, if formation is on he would be first).
Didn't test it, but you need to select those units at the same time and order them to move, otherwise the formation won't activate.
I've looked at many functions, but couldn't find anything relevant There are some of which I have no clue what they do
(such as SetUnitTypeSlots takes unit, integer).
Maybe the answer lies within those unknown functions, but I certainly couldn't find it.
The ping is still plausible though. What can change spacebar locations? As far as I know it's always with a unit (or structure) at the center. So if the spacebar location is different from the previous one
and does not have a unit at its center (you can check within a reasonable range), then it must be a ping.
The main problem is that you can ping at units as well, which would completely ruin the idea
Besides that, I can't be of any more help. I hope others will still look at this thread.