For alkalinity baking soda is your best bet. Just bake it in the oven for an hour, dump it in a 1 gallon water container and mix.
For magnesium, Epsom Salt is the way to go!
For calcium, unfortunately we can't make it anymore cuz they started to add a chemical called bromide to their mix.
so its bulkreefsupply.com for calcium or just your LFS.
You can find the exact MG to add by searching for Randy Homles Farleys articles on reef central.