A PSTricks solution:

 \documentclass{article}
 
 \usepackage{pst-plot}
 
 \begin{document}
 
 % parameter
 \def\size{5}
 
 \begin{pspicture}(-\size,-\size)(\size.57,\size.62)% found manually
 \multido{\iA = -\size+1}{\numexpr2*\size+1}{%
 \multido{\iB = -\size+1}{\numexpr2*\size+1}{%
 \psset{linewidth = 0.5\pslinewidth, linestyle = dashed, linecolor = gray!50}
 \psline(-\size,\iA)(\size,\iA)
 \psline(\iB,-\size)(\iB,\size)}}
 \psaxes[labels = none]{->}(0,0)(-\size,-\size)(\size.21,\size.21)[$x$,0][$y$,90]
 \end{pspicture}
 
 \end{document}

![output][1]

All you have to do is choose the value of `\size` and the drawing will be adjusted accordingly.

I've drawn the grid manually since [`pstricks-add`][2]'s function for this makes it look wierd, I think.


 [1]: https://i.sstatic.net/qKCiD.jpg
 [2]: http://www.ctan.org/pkg/pstricks-add