So how to decide when to move on ? Why?
Proper answer: do what's best for you, not for a hiring manager.
The main problem with staying too long with a company is that you get into a rut. If you're enjoying the work, learning new things, have a good team, and you get paid market rate, then why move? If you're unhappy about one or more of the above, then it's time to move on.
Changing frequently is a self-fixing problem. If hiring managers are rejecting your CV because you've not been in your current job long enough, then you'll be stuck there for another few months, and eventually you will have been there long enough. Unless you have a series of jobs under 2 years, don't worry about it. If you do have a series of jobs where you've only been there a few months, perhaps you need to be more picky about which jobs you accept.