anti-gank code works inversely to AP charges. So if you are worth 10 AP charges, only once that 11th person piles on to the gank will you see benefits. If you are worth zero charges, even 2 people will have trouble because you are a sad sack.
anti-gank code takes into account allies. If you have cabal allies (regardless of where they are) you aren't getting gang, but rather failing to fight a group battle when you clearly should be. So 3 ragers that are fighting separately see no anti-gank benefits from the 3 Imperials ganging them down.
Allies don't have to be limited to cabal buddies. Could also include anyone who isn't specifically an enemy by race/class/align/cabal dogma. So make friend with those neutral heralds if you don't want to get ganged to shit.