Quote:
Originally Posted by burn0050
Actually, that's not true. This function uses a constant % risk of your account. If you use 50 or 100 pip stop loss, the $ amount will be the same. That's why the lot size changes. For example:
A $25k account, using 1.5% risk, that means you are willing to lose $375. The function uses stop loss * pip value to determine how many lots will equal $375. So, a bigger stop loss will mean a smaller lot size. Conversely, a smaller stop will mean a larger lot size. Tight stops will mean that you may not be able to make a purchase, because your leverage would be too large.
If you use a 5 pip stop loss on the GPB/USD, at 2.0071. With a 1.5% risk on a $25k account would mean a lot size of 7.5 lots. The same stop loss with 3% risk would mean a lot size of 15 lots.
So, unless you are altering both the stop loss and the risk percentage, then you must view this function using a constant risk. I can build in more logic to review the leverage used on the account to determine if the purchase can be made, which would probably help in this case. But suffice it to say that using this function with a small stop loss and a large percent risk will probably get you a lot of rejected orders.
Thanks,
burn0050
|
I understand what you are saying when you take the stoploss into account and rick means how much you are willing to lose.
You must have posted different code. The function I copied from your earlier post does not use stoploss anywhere. If risk is 10 it returns 10% of the account equity. For a 10K account it returns 1 lot. If the stoploss is 50 then the loss trade would be a max of $500 if there is no slippage. This is 5% of the account. That means an actual risk of 5%. The risk input is more like percent of account to trade.
Robert