Compounding Lots

 

Hi, Could someone please help me with coding a lot calculator?

I want it to be like this Lots = ((Account Balance*Risk%))/(StopLoss+Spread)/(PipValue)

And then it gives me a number with one decimal.

For example:

Account Balance = 1000 $

Risk = 5 %

StopLoss = 30 pips

Spread = 3

Pipvalue = 10 $/pip (The value of one pip for one standard lot)

Lot = ((1000$*0,05)/(30+3)/10 = 0.2

Anyone can write this code for me?

Thanks

David

Reason: