View Single Post
  #1099 (permalink)  
Old 09-17-2007, 09:09 AM
dxtrade's Avatar
dxtrade dxtrade is offline
Senior Member
 
Join Date: Jul 2007
Location: Maldives
Posts: 194
dxtrade is on a distinguished road
Quote:
Originally Posted by burn0050 View Post
Are you sure you are not talking about the code from nix (the autolot function)?

I posted the code into post 1046, which you quoted in post 1048:
http://www.forex-tsd.com/150350-post1048.html

This line:
double lotMM = ( AccountFreeMargin() * (accountRisk/100) )/( MarketInfo(Symbol(),MODE_TICKVALUE) * stopInPips );

As you see, "stopInPips" is used in the equation. This function: MarketInfo(Symbol(),MODE_TICKVALUE) returns the value of 1 pip when you have 1 lot.

Since you were a mathematical analyst, let's do some math:

For USD/JPY:
$25k free margin, with a 1.5% risk, 50 pip stop loss:
(25,000 * .015)/(8.68 * 50) = 375/434 = .86 lots

.86 lots * 8.68 = 7.47 pip value (1 pip = $7.47)
50 pips * $7.47 = $373.50 (due to rounding, not quite $375)

So, let's see what happens with a 100 pip stop loss:
(25,000 * .015)/(8.68 * 100) = 375/868 = .43 lots
.43 lots * 8.68 = 3.73 pip value (1 pip = $3.73)
100 pips * $3.73 = $373 (again, due to rounding, not quite $375)

No matter what stoploss you put in, the dollar amount risked remains constant for this size account using this risk percent. As your account size changes, so will the dollar amount risked, but the percent risked remains the same. The stoploss does not affect the percent risked, only how much currency you buy.

If you see fault with my calculations, please tell me.

Thanks,
burn0050
I'm an absolute zero in coding...but looks like you are right on this one.
It's just the first time I see this. And I like it...by the way...as it is a real calculation of equity risk!
Reply With Quote