This question already has an answer here:
I hooked up my old 2012 retina MacBook Pro to an external 4k monitor via HDMI. It works fine while the lid is open, but as soon as I close it, various issues occur.
Monitor won't work or receive signal if I unplug MacBook from the charger (monitor has its own power supply).
Every now and then, monitor will shut/disconnect for a short while and come back online. I checked HDMI connection and everything seems to be fine (new monitor, new cable). What I did notice is that this flickering sometimes happens alongside charger light going off, which I think is related to point #1 above.
Does this sound like a bust charger that is going on and off for short periods of time, or something more serious with my MacBook?
Mac is set to never go to sleep be it on charge or battery, so I don't think this is an issue either.
This also seems to be unrelated to the option Slightly dim the display while on battery power. Just unchecked it, restarted and I am still getting the same issue.