Sleep is your number one friend! Diet in my opinion is of course second followed by exercise. I used to work shifts, really long periods of really long hours ie wayy outside any EU rules and for many many years survived on less than 5 hrs of sleep a day , sometimes less than that for a week or two stretches.
It really screwed up my body, type 2 diabetic by the age of 39 but in and around that I was also doing a lot of sport/ exercise.
Your body refusing to perform is a sign of an underlying problem that is not just diet related!
Assess how poor your lifestyle is first maybe even go to your docs and get a quick healthy man MOT then go from there.
Feeling good 10% of the time for me is not right IMO.