In my own experience with twitchy legs and difficulty sleeping, I did my research and found that a chelated magnesium was the ideal form of Mg. This is a mix of Mg diglycinate, Mg amini acid chelate, Zinc sulphate monohydrate, vitamin B6, chromium chloride hexahydrate, and selenomethionine. The brand I found here in Australia is Mega Magnesium.
I take a 500mg tablet at least daily and I try to remember it morning and night as it helps counteract the typically high calcium intake we have today. Dairy products, tahini and other sources of calcium mean we do little for our health over the years unless we get enough Mg, Zn, Se and antioxidants to keep the Ca in our bones and not our soft tissues.