Hi Mike,
welcome to CCC
Have you checked the
chess programming wiki?
Avoiding the horizon effect is usually not accomplished by using IID (which is mainly about improving the move ordering) but by introducing quiescence search (capture search, exactly your topic) and/or adding extensions.
Regarding your algorithm, it is difficult for me to understand what it does, where one possible reason for that might be that it includes both parts of the search in one. Most people use two separate functions, one for the full search ("level < max" in your case) and one for the quiescence search.
One point that might be missing in your algorithm is the proper handling of the "stand pat" principle in quiescence search, i.e. the moving side can choose whether it makes a capture (if that improves its evaluation) or does "nothing" and sticks with the static evaluation of the current node, assuming that at least one "quiet" move exists that would return >= this static eval. To achieve this you need to call the evaluation first, before expanding any possible capture, since you need it for comparison. I am not sure whether your algorithm works like this (it seems it doesn't).
EDIT: Regarding your questions, I propose that you
a) get the basic stuff running perfectly first before you try to add checks (and check escapes) to the quiescence search (it is not even necessary, and if you do it you would also need to restrict this to the first one or very few plies of qsearch),
b) do NOT restrict your quiescence search to recaptures on the same square, since that will overlook a lot of tactics.
Sven