-1
$\begingroup$

I'm currently working on a position sizing algorithm for my trading system. By combining fixed ratio money management and setting the stop loss based on the current ATR value I receive reasonable position sizes. However, this system breaks down as soon as I consider holding multiple positions at once.

Let me give you some context. Let's assume I have a \$10k trading account and I am trading stocks. On each trade I'm willing to risk a maximum of 2%, meaning \$200 (of course this figure'll change as soon as my trades go towards or against me). My simple EMA Crossover strategy on the hourly timeframe gives a buy signal for AAPL. Current Price for AAPL is \$204.96. 14period ATR is at 6.75, meaning that with a x*ATR with x=1 I'll place my stop loss at \$198.21 resulting in a risk-per-share of \$6.75. \$200/\$6.75 gives me 29.63, meaning that I can purchase 29 shares of AAPL when my stop loss is at \$198.21 and I'm willing to risk a maximum of \$200. 29 * 204.96 gives \$5943.84 or in other words the position size for this particular AAPL trade is 59.4% of my capital.

Now let's assume I want to keep my portfolio diversified and I'm willing to take up a maximum of 10 positions because a maximum of 20% risk at any time sounds reasonable. If I continue calculating my position sizes in the described manner I'll never fit more than two positons in my portfolio. I figured out that I can get smaller position sizes by lowering the risk per trade (e.g. 1% instead of 2%) or by giving the stop loss a bit more space (e.g. 3*ATR instead of 1*ATR). But is this the only way to achieve a more reasonable diversification?

I suppose I'm correctly applying my risk & money management rules, however, I'm not happy at all about the position sizes since I'd like to have more concurrent positions. Did anyone of you have a similar problem once? Does anyone have a more sophisticated algorithm that also considers the desired amount of max positions?

Thanks, la0wai

$\endgroup$
0
$\begingroup$

Unfortunately the issue you are running into is that your position size is a function of the recent volatility of the underlying. So, when the ATR is relatively low, your algorithm will require you to purchase more shares in order to get to your target risk per trade. When the ATR is high, the number of shares (& pct of total equity) will be lower (could only be 20% for example). There is no way around that, if you want to risk for example 2% per trade, and you calculate your stop loss distance ahead of time, you would by definition have to purchase that many shares. Otherwise, you would have to move your stoploss lower in order to risk more, but that's is anti logical.

Now, if you cap your algo to buy the lesser of for example 20% of total equity or the calculated number of shares, you might not be risking the full 2%, but you could take more trade signals that way.

number_of_shares = 29 percent_of_equity = number_of_shares * price_per_share / total_equity if percent_of_equity > .2: new_number_of_shares = total_equity * .2 / price_per_share

What you might want to do is look at how many assets you are going to run this strategy on (say 10) and then look at the frequency of trade signals. For instance, is it unlikely that you would ever have more than 3 trades on at once? Then, assuming you only want to trade 100% of your capital, you could come up with an arbitrary rule about how you want to split the capital.

For example, if you have no position, you might risk the lesser of 35% of capital, or the number of shares that you calculate. Then, if you already have a position, you will only use 20% of total equity, etc. Something like that, and you may choose to favor certain assets. Maybe you think your system works best on Apple, so you would take a bigger position on that. If you are writing this in a program, you could have a key, value pair list that details what your target risk would be for each asset ie {APPL : 0.35, AMZN : 0.25}

There's lots of possibilities, you should keep researching and thinking about what would be best for your system. There's probably not a numerical derivative that you can use, like you were hoping for, it's more subjective and depends on your trade system. Hope that helps.

$\endgroup$
0
$\begingroup$

Actually I believe your problem to be one of leverage. You are investing in stocks with cash on a non-leveraged basis but by nature of the way you are describing your risk you essentially want to create leverage, but of course that is impossible. Your framework contains inherent contradictions.

Consider this: the price of a share you decide to invest in is \$100. For arguments sake say you input a stop-loss at \$99.90, yet of a capital base of \$10,000 you permit yourself to losing \$200. By nature of the stop-loss price differential (\$0.1) and the allowed loss (\$200) you are suggesting purchasing 2000 shares, at a cost of \$200,000. You clearly don't have that capital available and therefore you cannot access the leverage you desire. This example was contrived with a small stop-loss to highlight the inherent problem.

A more traditional approach might be to consider a set of stocks which you can possible invest in: $$\Omega = \{Apple, Amazon, ..., Google\}$$ and a set of weights according to the proportion of your portfolio that will be allocated to these positions: $$ \mathbf{W} = \{w_1, w_2, .., w_n \}$$ With the requirement that $\sum_i w_i =1$. That way you will never invest more cash than your portfolio has to commit. If you focus on developing your algorithm so that it updates the weights according to your targeted and calculated beliefs you will probably have a more diversified and more stable portfolio, rather than 75% all in one stock at time 0 and 75% of your cash switched into another stock at time 1.

$\endgroup$
  • $\begingroup$ Your answer is interesting and I'm trying to follow it. Where do you get the losing 200.00 from right at the beginning. Thanks. $\endgroup$ – mark leeds Nov 8 '18 at 6:35
  • $\begingroup$ @markleeds that was the OPs assumption. He/She allowed a capital loss of 2% on a supposed capital of 10k. $\endgroup$ – Attack68 Nov 8 '18 at 12:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.