<metaname="description"content="MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\(','\)']]}}); If you can see into the future, that is.¶My previous class in Stochastic Calculus covered a lot of interesting topics, and ...">
<h3id="If-you-can-see-into-the-future,-that-is.">If you can see into the future, that is.<aclass="anchor-link"href="#If-you-can-see-into-the-future,-that-is.">¶</a></h3><p>My previous class in Stochastic Calculus covered a lot of interesting topics, and the important one for today
is the <ahref="https://en.wikipedia.org/wiki/Gambler's_ruin">Gambler's Ruin</a> problem. If you're interested in some of the theory behind it, also make sure to check out
<ahref="https://en.wikipedia.org/wiki/Random_walk">random walks</a>. The important bit is that we studied the <ahref="https://en.wikipedia.org/wiki/Martingale_%28betting_system%29">Martingale Betting Strategy</a>, which describes for us
a <strong>guaranteed way</strong> to <spanstyle='font-size: x-small'>eventually</span> make money.</p>
<p>The strategy goes like this: You are going to toss a fair coin with a friend. If you guess heads or tails correctly, you get back double the money you bet. If you guess incorrectly, you lose money. How should you bet?</p>
<p>The correct answer is that you should double your bet each time you lose. Then when you finally win, you'll be guaranteed to make back everything you lost and then $1 extra! Consider the scenario:</p>
<ol>
<li>You bet $1, and guess incorrectly. You're 1 dollar in the hole.</li>
<li>You bet $2, and guess incorrectly. You're 3 dollars in the hole now.</li>
<li>You bet $4, and guess incorrectly. You're 7 dollars in the hole.</li>
<li>You bet $8, and guess correctly! You now get back those 8 dollars you bet, plus 8 extra for winning, for a <strong>total profit of one dollar</strong>!</li>
</ol>
<p>Mathematically, we can prove that as long as you have unlimited money to bet, you are guaranteed to make money.</p>
<h1id="Applying-the-Martingale-Strategy">Applying the Martingale Strategy<aclass="anchor-link"href="#Applying-the-Martingale-Strategy">¶</a></h1><p>But we're all realistic people, and once you start talking about "unlimited money" eyebrows should be raised. Even still, this is an interesting strategy to investigate, and I want to apply it to the stock market. As long as we can guarantee there's a single day in which the stock goes up, we should be able to make money right? The question is just how much we have to invest to guarantee this.</p>
<p>Now it's time for the math. We'll use the following definitions:</p>
<ul>
<li>$o_i$ = the share price at the opening of day $i$</li>
<li>$c_i$ = the share price at the close of day $i$</li>
<li>$d_i$ = the amount of money we want to invest at the beginning of day $i$</li>
</ul>
<p>With those definitions in place, I'd like to present the formula that is <strong>guaranteed to make you money</strong>. I call it <em>Bradlee's Investment Formula</em>:</p>
<p>It might not look like much, but if you can manage to make it so that this formula holds true, you will be guaranteed to make money. The intuition behind the formula is this: The closing share price times the number of shares you have purchased ends up greater than the amount of money you invested.</p>
<p>That is, on day $n$, <spanstyle='font-size: x-small'>if you know what the closing price will be</span> you can set up the amount of money you invest that day to <strong>guarantee you make money</strong>. I'll even teach you to figure out how much money that is! Take a look:</p>
<p>If you invest exactly $d_n$ that day, you'll break even. But if you can make sure the money you invest is greater than that quantity on the right <spanstyle='font-size: x-small'>(which requires that you have a crystal ball tell you the stock's closing price)</span> you are <strong>guaranteed to make money!</strong></p>
<h1id="Interesting-Implications">Interesting Implications<aclass="anchor-link"href="#Interesting-Implications">¶</a></h1><p>On a more serious note though, the formula above tells us a couple of interesting things:</p>
<ol>
<li>It's impossible to make money without the closing price at some point being greater than the opening price (or vice-versa if you are short selling) - there is no amount of money you can invest that will turn things in your favor.</li>
<li>Close prices of the past aren't important if you're concerned about the bottom line. While chart technicians use price history to make judgment calls, in the end, the closing price on anything other than the last day is irrelevant.</li>
<li>It's possible to make money as long as there is a single day where the closing price is greater than the opening price! You might have to invest a lot to do so, but it's possible.</li>
<li>You must make a prediction about where the stock will close at if you want to know how much to invest. That is, we can set up our investment for the day to make money if the stock goes up 1%, but if it only goes up .5% we'll still lose money.</li>
<li>It's possible the winning move is to scale back your position. Consider the scenario:<ul>
<li>You invest money and the stock closes down the day .5%</li>
<li>You invest tomorrow expecting the stock to go up 1%</li>
<li>The winning investment to break even (assuming a 1% increase) is to scale back the position, since the shares you purchased at the beginning would then be profitable</li>
</ul>
</li>
</ol>
<h1id="Running-the-simulation">Running the simulation<aclass="anchor-link"href="#Running-the-simulation">¶</a></h1><p>So now that we've defined our investment formula,we need to tweak a couple things in order to make an investment strategy we can actually work with. There are two issues we need to address:</p>
<ol>
<li>The formula only tells us how much to invest if we want to break even ($d_n$). If we actually want to turn a profit, we need to invest more than that, which we will refer to as the <strong>bias</strong>.</li>
<li>The formula assumes we know what the closing price will be on any given day. If we don't know this, we can still invest assuming the stock price will close at a level we choose. If the price doesn't meet this objective, we try again tomorrow! This predetermined closing price will be referred to as the <strong>expectation</strong>.</li>
</ol>
<p>Now that we've defined our <em>bias</em> and <em>expectation</em>, we can actually build a strategy we can simulate. Much like the martingale strategy told you to bet twice your previous bet in order to make money, we've designed a system that tells us how much to bet in order to make money as well.</p>
<p>Now, let's get some data and run a simulation! Our first test:</p>
<ul>
<li>We'll invest 100 dollars in LMT, and expect that the stock will close up 1% every day. We'll invest $d_n$ + 10 dollars every day that we haven't turned a profit, and end the simulation once we've made a profit.</li>
<h1id="Summary">Summary<aclass="anchor-link"href="#Summary">¶</a></h1><p>We've defined an investment strategy that can tell us how much to invest when we know what the closing position of a stock will be. We can tweak the strategy to actually make money, but plenty of work needs to be done so that we can optimize the money invested.</p>
<p>In the next post I'm going to post more information about some backtests and strategy tests on this strategy (unless of course this experiment actually produces a significant profit potential, and then I'm keeping it for myself).</p>
<h1id="Side-note-and-disclaimer">Side note and disclaimer<aclass="anchor-link"href="#Side-note-and-disclaimer">¶</a></h1><p>The claims made in this presentation about being able to guarantee making money are intended as a joke and do not constitute investment advice of any sort.</p>