Here is the code I use for my money management. - Actually it shouldn't be called MM, as it is only calculates how many lots can I buy so that when I hit my stop loss I only loss a certain percentage of my account.
I think though that is one of the crucial aspects of forex- trading - as it leads to compound growth. I have not seen many other money management functions - but would like to hear others opions on money management.
Lots = Lotsize1(50,0.1,Symbol(),"mini");
double Lotsize1(int stoploss1, double risk1, string symbol1, string std_or_mini)
/* returns the number of lots one can buy for a certain symbol
* for a given risk level and stoploss. Returns Max 100 lots for a std or demo account.
*Returns max 50 lots for a mini account.
* The pip values for the function come from http://www.interbankfx.com/calculator.htm
*1 stoploss1 - what is your stoploss i,e, 10, 20, 30 etc pips, ensure that trailingstop is
* - less then stoploss1
* 2 risk1 - how much of your accounts free margin are you willing to loss
* 0.03 for 3%, 0.1 for 10%
* 3 std_or_mini - enter "std" for a standard or demo account, where the minimum transaction size is
* 1 lot of 100,000 of the base currency or enter
* "mini" - where the minimum transaction size is 1/10th
* the size of a standard lot, or 10,000 of the base currency.
* 4 symbol2 : the symbol your dealing with e.i. "EURUSD"
* The function determines your accounts leverage
* and returns the number of lots that you can then purchase
double AccountLeverage1; //the leverage of the current account
double pip; //one pip price - from http://www.interbankfx.com/calculator.htm
//this changes automatically based on either 'std' or 'mini'
//tocheck: before attaching EA - are your symbol definitions right?
if(symbol1 == "EURUSD" || symbol1 == "GBPUSD")
pip = 10;
else if(symbol1 == "USDCHF")
pip = 8.1;
else if(symbol1 == "USDJPY")
pip = 8.4;
//TODO: Actually if it can't find the right symbol - fail gracefully.
else return(0);// problem - just expand to include all symbols trading with
if (std_or_mini == "mini") // transaction size is 1/10th the size of a standard lot
pip = pip/10;
AccountLeverage1 = AccountLeverage();
pip = pip*AccountLeverage1/100;
//TODO: Don't loss more then risk% of AccountFreeMargin - not working right now
lots1 = NormalizeDouble(((AccountFreeMargin()/(stoploss1*pip))*risk1),2);
if (lots1 > 50)
if (std_or_mini == "mini")
lots1 = 50;
if (lots1 > 100)
lots1 = 100;
It was many talking about MM in EAs today.
So I found Money Management indicator and translated some comments on the chart from Russian to English.
Just unput desirable risk, price to open the order (for example) and price for stop loss. And read comments on the chart.
It is indicator (not script).
Here is something to consider when you decide your money management approach.
I'll have to admit I was disappointed in the pic (I expected something of more detail and usefulness). Money management or position sizing depends mostly on your trading system's expectancy.
Simply put let's say your strategy promises a gain of $2 for every $1 risked. Let' say out of four trades 3 usually ends up losing $1 and the 4th earns $8 (this is a simplification to explain a concept as in reality it would be more complex than this). So in four trades you risk $1 in each ($4 total) and in the end you have $8. At first glance one might say if we risk 25% of equity in each trade we'll end up with 200% equity after 4 trades right? Unfortunately its not as simple as that. After the 3 losses we're not sure the next is a gain, that would be falling for the gambler's fallacy.
In every trade there's a 75% chance of a loss and a 25% chance of a gain. In two trades there's a .75 * .75 = 0.5625 or 56.25% chance of two losses and a 0.25 * 0.25 = 0.0625 or 6.25% chance of two gains, while the rest is 100 - (56.25 + 6.25) = 37.5% chance of 1 gain and 1 loss.
Why do I bother telling this? Because you can see that it's easy to have 2 consecutive losses while it's unlikely (but still possible) to have 2 consecutive gains. Since it's said that for a possibility to be significant it has to have at least a 5% chance of happening, let's see how many consecutive losses is likely for this system. Multiplying 0.75 by 0.75 ten times gives us 0.056 or a 5.6% chance of happening meaning it's realistic to expect having more than 10 consecutive losses (actually I wouldn't be surprised if in reality max consecutive losses would end up twice that).
The objective of money management is to limit losses such that when the unfortunate event of experiencing that high number of consecutive losses we would still have enough equity to still trade and experience the gains. Take note if we lose 20%, the remaining 80% would need to gain 25% to recover (the 20% loss is equal to 25% of our remaining 80% equity). If however we lost 50%, the remaining 50% in equity would need to have 100% gain to recover, which is difficult to do. This is where risk preference comes into the picture, let's say we're only comfortable with losing 25%, the remaining 75% would need 33% gain to recover to the original equity, a somewhat achievable objective in my opinion. So to be sure let's expect 15 consecutive losses to be possible, and we would need those 15 losses to only take 25% of our equity, 25 / 15 = 1.67. So each time we trade we would only put 1.67% of equity to ensure that at worse we would only have a 25% loss in equity.
This does mean we might have less gains than when placing say 5% in each trade however we would also have significantly less chance of blowing up.
How accurate your calculation depends on how you determine the chance of a gain or loss. If you trade by discretion you would need to record each trade you make and need probably a year of trades before being merely somewhat sure of each trade's expectancy. With system trading, backtesting would give an idea (provided you use accurate historical data) and it would be best that you also do forward testing too.
I decided to post this since money management is being confused with different things and because most discussions are only about this or that indicator promising "great gains". The truth is you don't know the expectancy of an indicator in your system until you measure it, and failing to do so might lead you to place too much in losing trades and you end up blowing up before experiencing the gains.
Money Management via a ratio formula
Though I haven't started trading live yet, I've been investigating different areas of Forex trading and Money Management is very interesting.
I'm sure all you have heard the standard advice not to gamble more than 2% of your total funding on any one trade. I must confess that it sounds like a fairly prudent course of action to take, but is it the best mathematical way to grow your account? I'm going to present a hypothetical scenario and invite all to join in.
These are the initial premises:
a) You are a very experienced trader
b) On average you win 63% of your trades, lose 37%
c) Your fund is growing about 12% per month
Since the above trader knows from experience he's going to hit on 63 out of every hundred trades, and that he's going to average about 12% per month, shouldn't he employ some kind of fixed ratio or mathematical formula to adjust his trades? ....and if so, how would you arrive at it, and what would be the final percentages?
My gut feeling tells me the final ratio won't be too far from 2%. However, since many of us would tend to compound our accounts, even being off by a very small margin can have a huge effect. If the difference was "only" .5%, it will have an incredible impact in a year's time. What if the difference was in the order of 1% ? Just adding the extra 1% to your trades will increase the magnitude of your total profit by 33% !!! (all things considered, including losses!)
I've read on this subject and some fund managers consider risking .5% per trade good. Others go for 1%, a fair number stick to 2%; however, it stands to reason that the performance of a given trader (win/loss ratio), together with his established monthly compounded return, should lend itself to produce a mathematically optimized position size.
I invite all to partake of this debate and I thank you for your input.
I think a key concept to include in the analysis is the idea of standard deviation, or variance. Sure, you win 63% of your trades, but that doesn't mean you will win 63 out of your next 100 trades.
Have you considered the possibility of what losing 50 out of your next 100 trades will do to your equity? Assuming that you will always win 63 out of your next 100 trades will lead you to increasing your risk % per trade higher than what it actually should be (for an optimal result).
In poker, winning players also suffer from inevitable drawdowns. A noted mathematician and poker pro said that a mandatory bankroll to survive these drawdowns would be equal to:
(9s^2) / (4*WR)
Where s is your standard deviation per x hands, and WR is your win rate per x hands. This assumed that your "bad luck" would never exceed 3 standard deviations from your mean win rate, which I think was about 99.7% of the time those x hands occured.
Basically what I'm getting at is to determine your optimal risk level (so that your drawdown never exceeds a certain % of your total equity, analogous to the bankroll for poker), you not only need to know your win rate, but also the variance you experience.
I'm not sure how much variance varies (haha) between different trading systems. Maybe it's normally distributed and we can calculate some sort of baseline average that can be used for most trading systems as a start.
Taking that standard deviation, you could then say I want to never experience a drawdown larger than X%, Y% of the time (Y could never be 100 in theory, but you can get to be 99.7% or 3 standard deviations from the mean as a reasonable figure). X could be what you wanted it to be, most likely your account equity minus the margin required to keep your trades open.
I hope that helps get this started.
if i understand what you have said is if you lose 50 out of your next 100 trades you have broken even because you would have one 50 out of your next 100 trades also or if you lost 50 trades in a row you must have an enormous acct i always trade 2% of acct via pip amount for instance if i have 10000 my risk is 200 because i have a 20 pip stop alsways so that equals 1 full lot if i win my equity is 10200 so my risk nest is 204 since there is no lot size its still 1 full lot until i get above that which would be next win i make adjustsment so my risk and my reward always are at 2% all i need is method of trading to give me better that 60% for a very nice safe return i have been trading for 6 yrs at a 63% rate hey moneyline did you use my average or was it a coinsedence
Hi Fizzleboink, thanks for your input.
Sounds interesting, but would you have formulas that more closely apply to Forex trading than to Poker? BTW, what does the caret (^) symbol stand for?
Do you have enough information to come up with a better formula? I'm not an experienced Forex trader, but I will do my best to get whatever info you might need.
Your average jumped on my mind, I must confess to that. However, I've also read of other experienced traders getting about 60%
But that's just it moneyline, it should apply to forex trading as well.
WR could be the average number of pips you earn per 100 trades
s could be the standard deviation for the pips you earn per 100 trades
That formula (should) then tell you what your required balance should be to not go broke 99.7% of the time.
I haven't actually gone more in depth into this, it is just something I have been mulling over the past couple weeks. See I come from a successful stint at poker and am now learning about Forex trading (much more long term potential here). Much of the same money management concepts still apply, because it's just statistics (not to mention the psychological aspects but that's another story).
Coming up with an accurate WR and s could prove tricky though. In poker we would use it with real data, much of what we have in Forex trading is unreliable backtesting data. But I guess it could be a start?
Basically the formula boils down to the fact that the more reliable your trading system, the higher risk you can take without going bankrupt.
As for the carat (^), it's means "raised to the power of". So it's standard deviation raised to the power of 2, or standard deviation squared, or standard deviation multiplied by standard deviation.
OK, I see. I'd always used another symbol for squared, kinda looks like the letter V.
So, you're a card player? Me too! Matter of fact my game is Blackjack and I play a pretty mean hand. The first time I went to a Vegas casino they told me I couldn't play there anymore! Darn them, I was just having a good time!
As you mention, I've used money management to play in Vegas. Of course, there are a few other tricks of the trade, like:
a) Don't just pick the first table you see, go from one casino to the other 'till you find the right "table conditions." (sound familiar?)
b) Does the house cheat? You betcha! That's how come finding the right table is so important. If you can't find that, don't play that day!
Once I'm in the game though, I stand a very good chance of making bank. I never play with friends - other than for spare change - because they don't have my level of skill.
The same goes for many of our more experienced traders, they've seen lots of plays and there's very little that would surprise them. There are some here that would gladly give us data if we needed it.
BTW, though your chance probability bears to be mentioned, I have never encountered an experienced Forex trader that had a string of 50 losses. Maybe a bad month, or a not-so-good-one. I do know there are a bunch of traders that pay their bills from their earnings, month after month.