Headlight flash on and off by themselves

My headlights also do the same thing. I have the newer high intensity aftermarket lights that have the old style plugs on them. I have replaced both the switch and hi/low floor switch and the lights still flash on and off. I can turn em on and they will stay on for sometimes 15-20 mins and the flashing starts. It does not make a difference either high or low setting, they still blink. I am going to change back to the old style glass headlights.I thought about relays but i believe it would be a pain in the *** to have to wire them in.