# Stock average cost calculator (P&L and position size)

> Calculate your average cost per share across several buys, unrealized profit and return, and the position size for your risk and stop loss.

操作できるページ：https://www.calcopenly.com/ja/finance/stock-position-calculator
分野：お金の計算機

Average cost is the total paid for all your buys, fees included, divided by the number of shares held. Unrealized profit or loss is the shares times the current price minus that total cost. For a new trade, position sizing starts from risk: the amount you are willing to lose (account size × risk per trade) divided by the gap between entry and stop loss gives the number of shares, rounded down.

With the defaults, buys of 100 shares at 42.50, 50 at 38.20 and 25 at 45.00 cost 7,285, an average of 41.63 a share. At 47.10 the 175 shares are worth 8,242.50, a gain of 957.50 or 13.14%. Risking 1% of a 25,000 account, 250, with an entry at 47.10 and a stop at 44.50 allows 96 shares, and a target of 54.00 offers 2.65 times the risk.

The stop is assumed to fill at its price; a gap through the stop makes the loss larger. Taxes are not included.

## 入力

- **Buys (shares and price, one per line)**: For example 100 42.50 or 100 @ 42.50.
- **Fees and commissions (total)**
- **Current price**
- **Account size**
- **Risk per trade**
- **Planned entry price**
- **Stop-loss price**
- **Target price**

## 結果

- Unrealized profit or loss — 主な結果
- Return on cost
- Average cost per share (with fees)
- Shares held
- Total cost
- Market value
- Amount at risk
- Shares to buy for this risk
- Position cost at entry
- Reward-to-risk ratio (: 1)

## 計算式

$$
\bar p = \frac{\sum s_i p_i + \text{fees}}{\sum s_i},\quad \text{shares} = \left\lfloor \frac{\text{account} \times \text{risk\%}}{|\text{entry} - \text{stop}|} \right\rfloor,\quad \frac{R}{R} = \frac{|\text{target} - \text{entry}|}{|\text{entry} - \text{stop}|}
$$

## 計算例

### Three buys and a 1% risk plan

- Buys (shares and price, one per line): 100 42.50 / 50 38.20 / 25 45.00
- Fees and commissions (total): 0
- Current price: 47.10
- Account size: 25,000
- Risk per trade: 1%
- Planned entry price: 47.10
- Stop-loss price: 44.50
- Target price: 54.00
- **Average cost per share (with fees): 41.63**
- **Unrealized profit or loss: 957.50**
- **Return on cost: 13.14%**
- **Shares to buy for this risk: 96**
- **Amount at risk: 250.00**
- **Reward-to-risk ratio: 2.65 : 1**
- 照合元：Python decimal script: 7285/175 = 41.628571; 175 × 47.10 − 7285 = 957.50; floor(250/2.60) = 96; 6.90/2.60 = 2.653846

### Fees raise the cost basis

- Buys (shares and price, one per line): 10 100
- Fees and commissions (total): 10
- Current price: 90
- Account size: 25,000
- Risk per trade: 1%
- Planned entry price: 47.10
- Stop-loss price: 44.50
- Target price: 54.00
- **Average cost per share (with fees): 101.00**
- **Unrealized profit or loss: -110.00**
- **Return on cost: -10.89%**
- 照合元：(10 × 100 + 10)/10 = 101; 900 − 1010 = −110; −110/1010 = −10.891089% (hand calculation, Python decimal)

### Short trade with the stop above entry

- Buys (shares and price, one per line): 100 42.50
- Fees and commissions (total): 0
- Current price: 47.10
- Account size: 10,000
- Risk per trade: 2%
- Planned entry price: 50
- Stop-loss price: 52
- Target price: 44
- **Shares to buy for this risk: 100**
- **Reward-to-risk ratio: 3.00 : 1**
- **Position cost at entry: 5,000.00**
- 照合元：Budget 200 / risk 2 per share = 100 shares; reward 6 / risk 2 = 3 (hand calculation)

### Share count rounds down

- Buys (shares and price, one per line): 100 42.50
- Fees and commissions (total): 0
- Current price: 47.10
- Account size: 10,000
- Risk per trade: 1.5%
- Planned entry price: 23.40
- Stop-loss price: 21.75
- Target price: 28
- **Shares to buy for this risk: 90**
- **Reward-to-risk ratio: 2.79 : 1**
- **Position cost at entry: 2,106.00**
- 照合元：150 / 1.65 = 90.9 → 90 shares (floor); 4.60/1.65 = 2.787879 (Python decimal)

## よくある質問

### How do you calculate the average cost of a stock?

Add up what each buy cost, including fees, and divide by the total number of shares. For 100 shares at 42.50, 50 at 38.20 and 25 at 45.00, the cost is 4,250 + 1,910 + 1,125 = 7,285 for 175 shares, an average of 41.63. The position breaks even when the price returns to that average, plus any selling costs.

### How does averaging down lower my break-even price?

Buying more shares below your average cost pulls the average down. Holding 100 shares bought at 42.50, adding 50 at 38.20 lowers the average to (4,250 + 1,910) ÷ 150 = 41.07, so the stock needs to recover only to 41.07 instead of 42.50. It also increases the amount you lose if the price keeps falling.

### How many shares should I buy for my risk per trade?

Divide the amount you are willing to lose by the risk per share, the distance from entry to stop loss, and round down. Risking 1% of 25,000 is 250; with an entry at 47.10 and a stop at 44.50 the risk per share is 2.60, so 250 ÷ 2.60 = 96.15 gives 96 shares and a loss of 249.60 if the stop is hit.

### What is a good reward-to-risk ratio?

It depends on how often your trades win. The ratio is (target − entry) ÷ (entry − stop): 6.90 ÷ 2.60 = 2.65 for the defaults. At 2.65 to 1, winning more than 1 ÷ (1 + 2.65) = 27.4% of trades covers the losses, before costs; at 1 to 1 you need to win more than half.

### Is average cost the same as cost basis for US taxes?

Not for individual stocks. Under IRS Publication 550, if you do not identify which shares you sold, the first shares bought are treated as sold first (FIFO); the average-basis method is allowed for mutual fund shares and dividend reinvestment plans. Gains on shares held more than one year are long-term, and a loss is disallowed as a wash sale if you buy the same stock within 30 days before or after selling.

### 「Stock average cost calculator (P&L and position size)」の精度はどのくらいですか？

精度は入力値と計算方法の前提に依存します。十進演算には有効数字50桁を使いますが、推定、数値計算手法、元データの精度はそれより低い場合があります。表示の丸め処理でこれらの制約がなくなるわけではありません。 独立した出典の解答と照合した計算例：4。 例えば、「Three buys and a 1% risk plan」はPython decimal script: 7285/175 = 41.628571; 175 × 47.10 − 7285 = 957.50; floor(250/2.60) = 96; 6.90/2.60 = 2.653846と照合しています。

### この計算方法の出典は何ですか？

Van Tharp — Trade Your Way to Financial Freedom, ch. 14 (position sizing); FINRA — Understanding cost basis.

## 出典

- Van Tharp — Trade Your Way to Financial Freedom, ch. 14 (position sizing)
- [FINRA — Understanding cost basis](https://www.finra.org/investors/insights/cost-basis-basics)

_計画の参考用です。金融機関、税務当局、市場は独自の丸め方、手数料、規則を適用します。契約などの前に該当機関へ金額を確認してください。_
