When I first started playing I took lessons but I didn't really practice them. A few months a lessons is pretty important for basic technique though (like how to fret the strings correctly, and things like that.) I didnt like what my teacher wanted me to learn so I bought a guitar tab book of what was my favorite band at the time (if you don't know how to read tabs your going to have to.) I learned how to play the rhythm guitar on every song.
If you are already at this point then you need to know time signatures. I can't explain time signatures myself, but it is a simple concept, and you should have no problem finding what they actually are on the internet somewhere. After you know this you need to be able to play what the drums are playing. A drum machine with preset drum loops can help with this. This is the most important thing for you to learn.
Tension and resolution are also very important in heavy metal music. I would look up the scale of E minor on the internet (thats supposed to be the darkest sounding scale.) There should be 7 notes in the scale. The first note of the scale is where the sound of resolution is created. Also the 5th note of the scale offers some sound of resolution. All other notes will create the sound of tension. Alot of heavy metal songs play a part that either begains or ends with tension on the rhythm guitar and bass. That same part then begains or ends with playing the note of resolution with an irregular rhythm usually lead by the drums (on the scale of E minor, E minor would be note of resolution.) This entire part is usually repeated 4-8 times. This part is called the verse.
The following part would be the chorus. The chorus usually consists of a simple chord progression in the same scale. By simple I mean like 3-4 chords that are strummed for example 8 times each. the chorus is repeated 4-8 times usually. It is typical for a short solo (also called melody) to be played on a guitar where there is no vocal melody (this also can apply to the verse.) Melodies usually are the same everytime they occur within a song.
After you have a verse and a chorus you need a bridge. A bridge is, in my opinion, is more difficult to write. Depending on how the the song is arranged (I will explain arrangment shorty) I usually make either the chorus or the verse the bridge. I then alter how it is played by changing the rhythm, melody, adding some different riffs, tempo changes, or anything to make it sound different. Sometimes its cool to just create the bridge simply by fusing 1/2 of the verse and 1/2 of the chorus together. Bridges are typically played 4-8 times.
Guitar solos can be the hardest part to write. Most songs that I write don't even have solos. Many bands change keys in the rhythm section during guitar solos. A key is kind of the same thing as a scale. It is not nesscisary to change keys during a solo but it can make it sound much cooler. To change keys learning about modulation, the circle of 5ths, relative minors, and relative majors will all help. But this is pretty advanced stuff and will take time to learn.
In a 4/4 time signature the total number of beats in your song should be 4 when divided by 4 enough times.
Typical arrangements of songs off the top of my head include:
A B A B C A B
B A B A C B A
A B A B C B
B A B A C A
A- the verse
B - the chorus
C- the bridge and/or guitar solo
Heavy Metal is based off of classical music.
That should be more then enough information to keep you buisy for awhile
Bass guitar is the answer to everything