People in this thread with negative comments and oversimplified advice about writing metal don't actually listen to or understand metal, friend.
That said, metal has more in common with classical music and jazz than any other genre. Classical because it's methodically written riffs and it's layout, and jazz because of it's syncopation and tendency to stray from musical ”standards.”
I play metal so I listen to a lot of metal. It's easy to box yourself in if you only listen to the genre you are writing for. Although, metal has more subgenres than most other styles so there is a lot of material. But listen to everything that inspires; no matter the genre.
Playing fast and loud is terrible advice for writing metal. Calling it an awful genre are the words of someone who doesn't love music as much as they think. They probably only like one or two genres.
Last pieces of advice are to 1. jam with lots of different people to get the ideas flowing. And 2. Although theory can box you in, it can push you through a plateau if you use it properly.