Hhan44

Position Size Calculation with Fees - Handle any Leverage

Education
Hhan44 Updated   
INDEX:BTCUSD   Bitcoin
Example:
The account size is $4500.

We risk 2%, 90 cash, for this 2R trade.

If the trade idea is a success
we would now have 4678 cash in our account
a profit of: 178 cash
And if loss, a total of 4410 cash, 90 cash loss)

Is this correct?


Explanation:
The example seems correct but only without the fees in calculation.
Even small fees like e.g. 0.04% Taker (market orders) and 0.02% Maker (limit orders) add up a lot. A lot!

The example does need a position size of $56250, which would be $22.5 in fees just to open the position and the same amount again when the stop loss (market order) triggers or $11.25 when exit with a limit order.

The example does clearly need a leverage of 15 or higher to open that position size.
- Tradeable balance with 15x leverage: 4500 * 15 = 67500
- And to get a loss of 90 cash within 0.16 %: 56250 / 100 * 0.16 = 90

See Image on Chart: Calculation without fees

We will be fine with any kind of Leverage if we calculate it like that on every trade. The PnL is calculated from the real account balance. So we are on the right track to not blow our account.

If we calculate it with the Fees in mind, the example with 0.04% fees for open and close, then the position size would be $28125

See Image on Chart: Calculation with fees

The calculations show, even when it hits the Profit Target, the real Risk Reward lowers by a large amount. (The Example uses the same taker fee for open and close)

I personally recommend to automate those ever recurring calculations and set the orders via an API. Relative easy to code in e.g. Python.

I'm not allowed to link any external links here but some tools can be found on my Twitter (I'm not really active there otherwise):
- Some link to a Microsoft Excel sheet, which was used for the calculation images. It may be useful for some, just make a copy.
- And a public open source API Trade App can be found on my GitHub, link in the same Twitter feed.
No other funny links else.

And as last goodie: A small snippet example used in my automated strategies in PineScript, strategy.equity represents the account balance:
//Example 0.001 is minumum order
varip input_mathround = input(3, 'Decimal Math Round Size')
varip pnllosspercent = input(2, 'Dynamic PnL Loss - Percent of Balance')
getLongSizeDynamic(_entry, _sl) =>
pnl = strategy.equity / 100 * pnllosspercent
sl_percent = (_entry - _sl)/_entry
size_cash = pnl / (sl_percent*100) * 100
size_r = 1 / _entry * size_cash
size = math.round(size_r, input_mathround)
size
There are for sure different ways to optimise the math for the own liking.

This 'tutorial' is meant to give small insight into a proper position sizing, that you may too will not fear the leverage as useful tool when used correct.
With the calculations above, no matter if 10, 50, 100 or even crazy 1000x Leverage shall not blow our accounts! Still always keep the fees in mind, they take our money!
Comment:
Added an extra calculation, the more or less complete one, the fees on the loss. Now it's not even worth a trade with good Risk Reward anymore.
(And in case the chart overlays text/images because of scale)
Comment:
If we want to risk 2% of 4500 (90) without leverage then the price has to move 2% in either direction. The position size is all-in with 4500. If all-in with 4500 and price moves 0.16%, then the loss is 7.2 (without fees).

If we give the stop loss more room, like e.g. 4%, then a position size of 2250 is enough to risk up to 90.

To trade smaller price differences takes higher position sizes if we want to reach the same PnL in cash.

Leverage allows to trade the same sizes with less investment on the exchange, but takes more preparation with stop loss and fee calculations, especially useful if we want to hold multiple long term positions without being all-in.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.