Of course, only your doctor can tell what’s causing your particular problem. I have had some experience with charlie horses.
From my years on the cross-country team in high school, I remember that the folk remedy for a charlie’s horse is to eat more bananas. Bananas are high in potassium. Apparently muscles need potassium to respond to high-demand activity. If the potassium is too low, the muscle spasms we call a “charlie horse” result. Later when I moved on to ballet, the ballerinas recommended the same practice. Believe me, nobody stresses their leg muscles like a ballerina!
I have always used that simple remedy when I get leg cramps. I eat more bananas, and the problem goes away.
I don’t have any idea if that’s what’s causing your pains. I just know that it’s a very cheap, simple, non-medication remedy to try.
Hope you get the help you need.