|
Money Management III ... a continuation of Part II
|
In Part II we talked about a modification of the Kelly Ratio for determining how many shares to trade ... with each of N trades.
We got this far:
Maximize, with respect to the N variables Sn:
log P
= Σ log[ 1 + d Sn / { E+ d ( S1+S2+...+Sn-1)} ]
where the sum is from n = 1 to n = N
where
p is the probability of a daily gain (so 1-p is the probability of a loss)
$W = the average daily share gain, or Winnings
$L = the average daily share Loss
$[ p W - (1-p) L ] is the expected daily dollar gain
T = average number of days between trades
$d = [ p W - (1-p) L ] T is the expected dollar gain per trade, for each share
S1, S2, ... SN are the number of shares traded with each of the N trades
and the initial portolio is E = E1 ... just before the first trade.
|
>It'd be nice if you gave an example. That's a messy formula and ...
Okay. Here's an example, using Exxon stock over the last year as in Figure 1:
The daily parameters are were:
W = $0.91 average daily gains L = $1.02 average daily losses
p = 0.57 or 57% of the time there were gains (not losses).
One Buy&Sell scheme had N = 31 trades in the year, so T = 250/31 = 8 trading days between trades (assuming 250 market days per year)
Then $d = [ p W - (1-p) L ] T = [(0.57)*(0.91) - (0.43)*(1.02)]*8 = $0.64 so ...
>What? You make just 64 cents per trade?
No, it's a 64 cent gain for each share traded ... and I haven't yet calculated how many shares to trade.
If we traded 1000 shares we'd have made $640 in T = 8 market days and that's $20K in the year and ...
>All this is "on average", right?
|  Figure 1 |
Well, we're talking about actual historical trades, so it's exact. We come to the "on average" part when we extrapolate from the past to the future.
If our initial portfolio is E = $100,000 and the number of shares traded is S1, S2 etc., then we're talking about
maximizing a sum, each term of which is logarithm of something like:
1 + d Sn / { E+ (0.64) ( S1+S2+...+Sn-1)}
= 1 + (0.64)Sn / { 20,000+ (0.64) ( S1+S2+...+Sn-1)}
We make the following observations and adjustments:
- We expect d = 0.64 to be small, in general, compared to E = 20000, the initial portfolio, so we divide everything by E
... because we love small numbers
- We stare at 1 + [(0.64)Sn/20000] / { 1 + (0.64) (S1/20000+S2/20000+...+Sn-1/20000)}
- We note that all the Ss appear in a ratio like (0.64)Sn/20000, so we let: xn = (0.64)Sn/20000.
- We look at the result, namely: 1 + xn / (1 + x1 + x2 + ... + xn-1)
which can be written:
(1 + x1 + x2 + ... + xn) / (1 + x1 + x2 + ... + xn-1)
- Since we're talking about logarithms of this ratio, we'd get log(numerator) - log(denominator) and we're summing all this stuff.
- To simplify, we let yn = 1 + x1 + x2 + ... + xn so we now have the ratios:
(1 + x1 + x2 + ... + xn) / (1 + x1 + x2 + ... + xn-1) = yn / yn-1.
>Okay, but when the smoke clears what have you got?
I got this to maximize:
| log P | = Σ log[ (1 + x1+ x2 + ... +xn) / (1 + x1+ x2 + ... +xn-1) ]
| | = Σ log[ yn / yn-1]
| | = Σ {log[yn] - log[yn-1] }
| | = {log[y1] - log[y0]}
+{log[y2] - log[y1]} +...+ {log[yN] - log[yN-1]}
| | = log[yN] - log[y0] = log[yN/y0]
| | = log[yN] ... since y0 = 1.
|
Hence and therefore: P = yN
... after N = 31 trades.
>It's that simple?
Actually, if we look carefully at the guys called xn = (0.64)Sn/20000, they're just the dollar gains at each trade, as a fraction of the initial portfolio.
Further, yn is the cumulative sum of all the previous gains.
The result P = yN just says that the final portfolio is yN, the sum of all these daily gains, starting with the initial portfolio.
>Why didn't you just say that from the beginning?
It's called mathmanship. Ain't it fun?
>NO! Besides, how many shares are we supposed to trade?
Patience.
We've been looking at historical results, using some unspecified Buy&Sell strategy.
If you really believed that, in the future, you'd make $0.64 on each traded share, then you should buy a jillion shares every single market day.
By year's end you'd be a multi-jillionaire.
Alas, the future is NOT a replica of the past and we gotta introduce some randomness. To this end we might do the following:
- Look at the distribution of daily $Wins and $Losses, noting the Average and Standard Deviation.
- Assume some Probability distribution (normal, lognormal ... whatever you like best: Fig. 2 shows Normal).
- For the future, pick a daily Win/Loss at random and apply it to your portfolio.
- Repeat for N trades to get a final portfolio.
- Repeat steps 3 and 4 umpteen times, a la Monte Carlo ... assuming some number of shares traded for each trade.
- Vary the number of shares traded so that ...
>Just do it!
Patience.
Remember that we're not generating some Buy / Sell strategy. We're using your favourite strategy.
We're just suggesting how much to buy or sell at each trade. Hence, the timing of trades is up to you.
When you decide to Buy or Sell, just ask "How Much?"
>And you'll tell me?
Uh ... not me. This money management strategy will tell you ... if we ever get it finished.
Just remember: This is fiction. It's a sandbox to play in.
|  Figure 2 |
>If we ever get it finished? What does that mean?
It means I may never get it finished. Don't you see the in progress sign at the end of this tutorial? I usually lives at the bottom of tutorials because ...
>So what if I want to play?
Here's another spreadsheet sandbox for you. It goes like this (where Bollinger is the Buy/Sell strategy):
- You pick a stock (Example: GE)
- Buy or Sell when the price hits the Lower or Upper Bollinger band (respectively)
- You specify the Bollinger parameters. (Example: Bolli-UP = 26-day average price + 2*(standard deviation) and Bolli-DN = 26-day average price - 2.5*(standard deviation) )
- You start with a bunch of Shares (Example: 1000) and a bunch of Cash (Example: $50,000)
- You trade a fixed number of shares with each trade, either bought or sold (Example: 200)
- Cash grows at a fixed rate (Example: 2.00%)
- You gaze in awe at the charts.
>What's the Maximize button?
The spreadsheet runs through a bunch of Share amounts and picks the number which maximizes your Portfolio Compound Annual Growth Rate.
(Example: From 50 to 1000 in steps of 50)
>And the spreadsheet works good?
Did I mention my money-back guarantee?
>Okay, so I look at the past, figure out the best number of shares to trade, then use that for my next umpteen trades, right??
Sure. Remember: The future is a replica of the past!
>Be serious! This can cost me money and I'd like to know if ...
Aah, then you'll just love this addition to that last spreadsheet.
It looks like this:
After having downloaded a year's worth of daily prices (hence returns), you move to another part of the spreadsheet and click some buttons:
- Click Randomize and a year's worth of returns are selected at random from the downloaded returns ... and charts displayed
- Click Maximize and, for that randomly selected set of returns, the "best" number of shares is calculated ... and the charts updated
- Click do the Monte and steps #1 and #2 are repeated N times, each time the percentage of times that the Portfolio CAGR beat the (randomized) stock CAGR is determined.
When the smoke has cleared:
- you get to see how often that "Optimal" number of shares gave a CAGR better than a buy-and-hold strategy Example: 63% of the time
- Finally, the "best" (randomized) stock prices and the optimal number of shares which generated the "best" CAGR comparison ... they're displayed
Example: 7.8% vs -24.4%
>And what good is that?
It shows that, with exactly the same set of daily returns (but selected at random) you get a different stock price evolution hence a different "optimal" number of shares hence ...
>Hence you can't trust the "optimal" based upon just one set of historical data. Is that what you're saying?
Something like that ... but it's great fun to try!
You'll also get to see the worstest "Monte Carlo" scenario
|