Thursday, February 14, 2013

Individual Trade Risk and Position Sizing


 I have discussed how “R” works in the past.  If you want a better explanation than mine, check out these two posts from Brian Lund at www.bclund.com:


Not to beat a dead horse, but the steps to determining how R works are as follows:

1.         Determine how much you are willing to lose on any one trade – this is your R.

This calculation is obviously dependent on a lot of factors, but here are some ideas you can use to determine your : 

-           Rule of Thumb.  You can use a rule of thumb – never risk more than 1% of your    capital account on any one trade. 
-           Max Losses.  You can try to simulate your trading system to determine the            maximum number of losses you incurred in a row and then add a safety valve.    Say that through backtesting you found that you had 8 losses in a row.  In the            real world, double that value to say that you would probably have 16 losses in a   row.  Divide your capital account by this amount and you would never run it       down all the way.
-           Maximum Adverse Excursion.   The MAE is the largest loss suffered by a trade   while it is still open.  A position may move against you by 5 ticks but is closed out at a loss of 2 ticks.  The MAE would be -5 ticks.  Link:  “A particularly large MAE       might reveal that actually it would not work in practice because the MAE would    be too       large for the proposed account size, perhaps eliciting a margin call that     would render the backtest results inaccurate and misleading.”
-           Security Specific Calculation.  Using the standard deviation, ATR or other            volatility based calculation could help determine the room that you would have      to give a specific trade to be successful.

2.         Determine the trade specific stop.

This is the risk of the individual trade.  It may vary from trade to trade.

3.         Find the position size by dividing step #1 by step #2.

Looking at an example, assume you have a $20,000 risk capital account and you determine that you are not willing to risk more than 1% or $200 on any 1 trade (Step #1).  The next trade needs a stop of $50 to be successful (Step #2).  Divide $200 by $50 and you get 4, which means that you should buy 4 contracts  (Step #3). 

Position sizing is important.  Assume that you think you have an edge based on some type of indicator (moving average etc).  When this edge presents itself, you put on the trade and never accept less than a risk to reward ratio of 1 to 2.  However, while the ratio of risk to reward may remain the same, the actual outcome of each trade (in terms of ticks) may be different.

To prove that position sizing is important, let’s create a simulation that assumes the following:

-           Risk to reward ratio of 1 to 2
-           Starting capital account of $20,000
-           Tick value equal to $5
-           Winning percentage of 30%
-           Variety of individual trade results.




The table above represents a system that has a broad range of individual trades results but the same risk to reward ratio.  On one trade, you risk 5 ticks to make 10 ticks but on another trade you may risk 20 ticks to make 40 ticks. 

On any given trade, you may win or lose based on your system’s average winning percentage.  This will result in either an increase or a decrease of the capital account.
Running the simulation over 500 trades and repeating the simulation 1000 times, you get the following ending account value statistics (30% winning percentage, 1:2 Risk to Reward Ratio):


On average, using no position sizing, we would draw our account down to 16,937 after 500 trades.  Not great for a 1:2 Risk to Reward ratio system.

Here is what the ending account values looks like over a variety of Winning Percentages (500 trades simulated 1000 times) WITHOUT position sizing and a 1 to 2 risk to reward ratio:



So what happens when we employ position sizing?  That is, we make sure that when we have a trade that risks 5 ticks, we buy more contracts than when we have a trade that risks 20 ticks. 

Here is what the ending account values looks like over a variety of Winning Percentages (500 trades simulated 1000 times) WITH position sizing equal to 1% of the starting capital account and a 1 to 2 risk to reward ratio:



As you can see, using position sizing boosts the ending account value tremendously.  On average, sizing the positions accurately based on a 1R = 1% of starting capital resulted in ending account sizes 2 to 2.5 times in size on average.  This is not insignificant.

Keep ya mind right.









Monday, February 4, 2013

Coin Flips, Risk to Reward Profile and Creating Your Own Synthetic Security


“Cut your losses short and let your winners run”
 “Picking stocks is the easy part.  The hardest part is managing your trade and your emotions.”
 “The certainty of misery is preferable to the misery of uncertainty”
 Size matters…”

There is an interesting thread discussing the fallacies behind the coin flip theory and the law of large numbers.  The opening post says:

Assuming no slippage and commission (an ideal world) and you have a 1:1 risk reward profile the odds of you winning are 50%. You can flip a coin randomly in the market and you would win 50% of the time. After a couple of hundred trades flipping a coin you would be break even on ticks (again assuming no trading costs).

HOWEVER, if you risk 1 to make 2 the odds are not 50/50 because you are expecting the market to move twice as far in your favour to make a profit. To use the coin example again, 1:1 risk reward is a 0.5% chance of winning. However a 1:2 risk reward the odds of you winning are 0.5 x 0.5 = 0.25% chance of winning.

Only problem is that the conclusion is incorrect.  A 1:2 risk reward gives a winning percentage of 33% assuming completely random outcomes of a security.  Let's figure out why.

If we assume a fair coin and a heads is a win in the market and a tails is a loss in the market, then a 1:1 risk to reward profile would leave us at break even as the number of coin flips approach infinity because eventually your losses will equal your wins (insert the standard disclaimer that we aren’t going to consider commissions and slippage).

The second paragraph then applies a little conditional probability.  Conditional probability is the probability that something will happen given that something else has already happened.  Thus, the probability of getting 2 heads in a row is the probability of getting a head followed by a second flip where you also get a head.  We can either find this out using a formula or through Monte Carlo simulation.  The post is correct that the odds of getting two heads in a row is 50% x 50% = 25%.

If we are to assume a completely random market, then there is an independent and equal chance that the market will either go up a tick or down a tick over the next time increment. Recall that a tick is the smallest movement that a security can move in the market.  In a random market, one tick would also have to be independent and distinct from the previous tick.  That is, tick 2 is not dependent on the outcome of tick 3.

The beauty of Excel is that we can create our own random data.  Check out a couple of screenshots of a “synthetic” security I created that has a starting value of 2000 and a tick size of 0.25.  Over 1000 time increments our “security” looks like this:


OR it looks like this:




For an excellent read on how to construct your own Excel file with a “synthetic” security, check out Coin Tosses and Stock Price Charts by Timothy R. Mayes, Ph.D.

What if we randomly enter our synthetic security both long and short and we don’t exit our position until either one of two things happens:  (1) we get stopped out (consider this our “risk”) or (2) we hit our profit target (consider this our “reward”).  Let’s go back to the original post – remember, it stated that at a 1:1 risk to reward, our winning percentage would be 50% and at a 1:2 risk to reward, our winning percentage would be 25%.  Since our synthetic security’s price is based on the “flip of a coin” is it reasonable to assume that our winning percentage both long and short is then going to be equal to 25% using a risk to reward profile of 1:2?

Turns out that the assumption is not correct.  I created a Monte Carlo Simulation in Excel of a synthetic security that had 1000 ticks.  Whether it was an uptick or a downtick was completely random, i.e., there was an equal chance that the security would tick up or tick down over each time increment.  The simulation was run over 500 trades – long or short entry was random.  The trade was either stopped out or hit its profit target.  I repeated these 500 trades 20 times for a total of 10,000 trades. 

For a 1:2 risk reward profile, the results are below for 20 trials of 500 trades:


Based on 10,000 trials, the average winning percentage is 33% with a standard deviation of 2.8%.  But wait, isn’t there a better way of determining this?  Yes, grasshopper, there is.  And it is called Expectancy. 

Expectancy  = (Avg Win * WP) – (Avg Loss * (1 – WP),

where,

WP = Winning Percentage

A positive expectancy means that you have a profitable trading system, ie, for every dollar risked, you can “expect” a certain amount back on average over the long run.

The formula to find the minimum WP for a “break-even” expectancy system is:

Breakeven WP = 1 / (W/L + 1),

where,

W/L = Win Loss Ratio (or risk to loss ratio).

So the Min Winning Percentage for a positive expectancy system with a risk to loss ratio of 1:2 is

Min WP = 1/(2 + 1) = 1/3 = 33%!

Keep ya mind right.