It is possible to have slightly off cortisol and still have AF. My cortisol was never super terrible (like one or two points below reference range in the afternoon, one point above reference range in the morning, and normal at night). My issues were more with aldosterone.
Magnesium oil will probably be better for you than ingested magnesium. I don't do well with capsules, but am fine with the oil. Its also the best as far as absorption goes as well