Sounds like youre not digesting your food and the body is trying to get rid of it as quickly as possible.
For irregular heartbeats I need the right ratio of Ca/Mg (currently a 6:1 for me probably because I was having calcium malasborption), plenty of Coq10 and specially carnitine. You may not be making enough carnitine (due to protein maldigestion) to properly use the fats in your diet (which the heart needs to function). Sleep/melatonin regulation is also very important for regulating heartbeats (irregular heartbeats often a sign of dysautonmia).
You should primarily boost your digestion via means of increasing stomach acid. This will restore proper pH levels in the gut and naturally control candida and bacterial overgrowth. It will also help trigger pancreatic and biliary discharges to help you digest the food you eat.
The food will be regarded as toxin to your body if you can't digest it properly and will try to eliminate it from the system (like IBS). Focus on improving digestion and everything else will fall into place. You may have developed food intolerances due to prolonged maldigestion so you may want to keep an eye for them).
You may want to consider larger doses of niacin to naturally raise stomach acid levels along with betaine HCl/digestive enzymes with meals to help you in the mean time.