Formula to calculate Stop Loss based on account variables

302 Views Asked by At

I am trying to generate a formula that uses the following variables:

  • a = account balance
  • e = position entry point
  • L = leverage used
  • p = percentage of loss (in % format, not decimal)
  • x = stop loss price

this formula is trying to solve for x

a couple attempts generated this formula: $$x = {ap\over 100}\times {e \over aL} + e$$

but it came to be that acccount balance (a) factored out, and was useless.

The goal is to generate a stoploss price that when hit, would be p% loss of total account size when using leverage(L). If we were to use real numbers, they would look like this

EXAMPLES

My account has 0.105(a) BTC and I want a stoploss of 9%(p). If I enter in a position of 9613(e) with 4.7x(L) leverage, I should have a stoploss price of around 9802(x) in a short (im betting the price is going down, but instead it went up)

My Account has 9.43 ETH and I want a stoploss of 9%. If I enter into a position of 170.90 with 1x leverage, I should have a stoploss price of around 173.9 (math above calculates it as 182.6 giving a percentage of 6.87% instead of 9)

if my account balance(a) is larger, the price, x, should be higher

2

There are 2 best solutions below

0
On BEST ANSWER

I found that I only need to use the Account Balance (a) to determine the true Leverage(L) and this much simpler formula got me there

for a buy order: $$x = e-(p/L\times 0.01)\times e).$$

for a sell order $$x = e+(p/L\times 0.01)\times e).$$

3
On

You are expressing the acceptable loss as a percentage of the account, so the stop loss price should be higher than the entry point by a fixed percentage. If you had one account with $1$ BTC or ten accounts with $0.1$ BTC each, you would be willing to take the same percentage loss, so the stop loss value should be the same.

If you are willing to accept a $p\%$ loss, you hit that when the price moves by $\frac pL\%$ when you use leverage. Your formula reflects that, so if you are willing to accept a $9\%$ loss with leverage $4.7$ the price needs to move $\frac 9{4.7}\% \approx 1.9\%$, which agrees with your calculation.