I am encountering a small problem. My account is in CHF. I need a function that calculates the amount that I have to put in a currency, knowing that my stop is x pips and that I want a maximum risk of 3% of my account value in the base currency.
For example: I would like to take a position in EURUSD with a stop of 50 pips. Account value CHF 15000. I don't want to loose more than 3% (CHF 450). What would be the amount of EURUSD I should take for these above parameters.