To determine the number of protons in the metallic ion \( Z^{2+} \) with 18 electrons, we start by considering the number of electrons and the charge of the ion.
The ion \( Z^{2+} \) means that the element has lost 2 electrons to form the ion. If the ion \( Z^{2+} \) has 18 electrons, the neutral atom of the element (before losing electrons) would have:
\[ \text{Number of electrons in neutral atom} = 18 + 2 = 20 \]
In a neutral atom, the number of protons equals the number of electrons. Therefore, the neutral atom would have 20 protons.
Thus, the ion \( Z^{2+} \) contains 20 protons.
So, the correct answer is: 20