View Single Post
  #1102 (permalink)  
Old 09-17-2007, 10:11 AM
MrPip MrPip is offline
Senior Member
 
Join Date: Mar 2006
Location: La Verne,CA
Posts: 560
MrPip 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
You are right, I used nix AutoLots function.

I now have one more change to MM. I will now add your code as well and have a switch to chose which to test.

Robert
Reply With Quote