October 12, 2014
Position sizing based on risk
One of most popular position sizing techniques is Van Tharp risk-based method. Van Tharp defines risk as the maximum amount that can be lost in a trade. Typically you limit your loses by setting up a maximum loss stop.
The amount risked should not be confused with amount invested. If your stop is 15% away from entry price, in worst case you risk losing 15% of the position size (amount invested), not the entire amount. So risk practically means the amount of maximum loss stop.
Now, imagine that we only allow to lose 1% of entire portfolio equity in single trade. If our stop is placed 15% away, it means that to risk just 1% of entire equity we can put 1/15 part of our available equity into this trade. As we can see desired position size is inversely proportional to stop amount.
Buy = Cross( C, MA( C, 20 ) ); // some trading rules
Sell = Cross( MA( C, 20 ), C );
//
PositionRisk = 1; // how much (in percent of equity) we risk in single position
TradeRisk = 15; // trade risk in percent equals to max. loss percentage stop
PctSize = 100 * PositionRisk / TradeRisk;
//
ApplyStop( stopTypeLoss, stopModePercent, TradeRisk, True );
SetPositionSize( PctSize, spsPercentOfEquity )
Let us see how it works, say we have equity of $60,000, and we only want to risk 1% in single trade ($600). We set our protective stop to 15%. If stock entry price is say $20, we would put our protective stop at $20-15% = $17, so we will risk $3 per share. Given the fact that we want to risk only $600 in that trade, we could buy 200 shares (position risk 200 * $3 = $600). 200 shares @ $20 each gives position value of $4000. $4000 represents 6.667% of $60,000 and this is actual percentage position size we would open. As we can clearly see 6.667% is what we would get if we divide 1 (percent position risk) by 15 (percent loss amount): 1/15 = 6.667%
Instead of setting our stop as fixed percentage, we can use more sophisticated methods. For example we can adjust our maximum loss (so the risk) dynamically, using average true range, so it will get wider if stock is volatile and narrower if stock prices move in a narrow range. Say we want to set our stop to twice the amount of ATR( 20 ) at the entry bar and risk 3% of portfolio equity in a single trade:
Buy = Cross( C, MA( C, 20 ) ); // some trading rules
Sell = Cross( MA( C, 20 ), C );
//
RiskPerShare = 2 * ATR( 20 );
ApplyStop( stopTypeLoss, stopModePoint, RiskPerShare, True );
//
// risk 3% of entire equity on single trade
PositionRisk = 3;
//
// position size calculation
PctSize = PositionRisk * BuyPrice / RiskPerShare;
SetPositionSize( PctSize, spsPercentOfEquity )
This time our maximum loss (so the risk per share) is expressed in dollars not in percents. Let us verify the above calculation. Assume that our equity is $90,000, stock price is $18, ATR(20) is $1. Now risk per share (the stop amount) equals 2 * $1 = $2, so our calculated position size (required % of equity) from the above formula would be:
PctSize = 3 * $18 / $2 = 27%
27% of $90,000 means trade size of $24,300, i.e. 1350 shares (@ $18 each). Since we risk $2 on each share, the total risk is $2 * 1350 shares = $2700, which is exactly 3% of our total equity ($90,000 * 3%).
In case of futures, we would need to take into account the fact that our position size depends on Margin Deposit, while the stop size (expressed in dollars) depends on the Point Value, so the position sizing formula would need to be modified.
Buy = Cross( C, MA( C, 20 ) ); // some trading rules
Sell = Cross( MA( C, 20 ), C );
//
RiskPerContract = 2 * ATR( 20 );
ApplyStop( stopTypeLoss, stopModePoint, RiskPerContract, True );
//
// risk 1% of entire equity on single trade
PositionRisk = 1;
PctSize = PositionRisk * MarginDeposit / ( RiskPerContract * PointValue );
SetPositionSize( PctSize, spsPercentOfEquity )
Let us assume that we are trading a contract with $5000 margin deposit, point value $50, our equity is 1 million and ATR(20) is equal 5 big points. Risk per contract is then 10 big points. Now the above formula would give us:
PctSize = 1% * $5000 / ( 10 * $50 ) = 10%
10% of our 1 million equity is $100K, which allows us to buy 20 contracts (20 * $5000 each). Since our risk is 10 big points and each big point has a value of $50 we are risking 10 * $50 = $500 per contract. We have 20 contracts so entire position represents a risk 20 * $500 = $10,000 which is 1% of our 1 million equity.
Filed by Tomasz Janeczko at 4:11 pm under Backtest
Comments Off on Position sizing based on risk