money management with fix risk in mql

i want to write money management code with fix risk i ude below forumuls:
double pos_lot=NormalizeDouble(margin/(sl*tick_value),2); // max lot size
but it dont work in XAUUSD and XAGUSD could any body  help me fix that?


thanks.

How? Fix your code
If you post a code, pleas use the "code" button or just press (Alt+S)