Hi,
Really like having auto hold and an electronic handbrake but for some reason just recently, I've nearly been caught out with the car rolling away when parked

Had the car since May, 4000+ miles on it now. It's manual. I have auto hold enabled.
I never used to engage the manual handbrake at all. I'd come to a stop, get green then when I switched the engine off, (I think it then changed to red).
On starting, sometimes it would come up red, sometimes nothing at all. Sometimes I could just pull away with the red, sometimes I would have to apply foot brake and disengage handbrake. I know the auto hold will not work if you do not have your seatbelt on.
I can't work out what requirements I need for the handbrake to come on and off automatically. I'm getting into the habit of doing it manually now after 2 or 3 scares.
Can anyone help?