I don't know about that? I did have a few bad dreams growing up, but none that I could call nightmares. However, these days, and I'm over 50, I cannot remember the last time I had even a bad dream.
Personally, I think dreams/nightmares are a reflection of our soul. If we are at peace within, good dreams come, and vice-versa.
I have no proof of this, but just that it seems to work out that way a lot of the time.