MBP 2010 external monitor not waking
Based on your reply, first to check is the cable or connector.
Software does not randomly connect or disconnect and because you say it works after you plug-in and un-plug the cable a few times it works... the cable might be broken.

If you have a replacement, try it - else you could buy one (and return if it does not solve the problem). Based on your reply with VGA it works fine, I would definately buy a new cable/connector.