Looking for a formula finder...

lamasticot

New member
Joined
Sep 3, 2020
Messages
1
Dear all,

I have the below inputs and formula

My end goal would be to find a formula for max_leverage (instead of current value 109) that would enable to have distance_percent / abs(change_percent_price) = cap_percent.

Is anyone able to find what would be the formula for max_leverage? So that distance_percent / abs(change_percent_price) = cap_percent?

Thank you so much in advance.


Inputs
max_leverage = 109
risk_per_trade = 100
distance_percent = 0.5%
price = 8000
maintenance_rate = 0.4%
LTV = 102%
cap_percent = 98%

Formulas

amount_risked = risk_per_trade * max_leverage * distance_percent
my_investment = risk_per_trade/amount_risked * risk_per_trade
quan = (my_investment * max_leverage) / price
notional_value = quand * price
maintenance_margin = notional_value * maintenance_rate
collateral = LTV * maintenance_margin
unrealized_pnl = collateral - my_investment
change_price_percent = (unrealized_pnl + notional_value) / notional_value - 1
 
I think the first step is to carefully double check, and if possible simplify, your formulas. For example...

my_investment = risk_per_trade/amount_risked * risk_per_trade
my_investment = risk_per_trade^2 / amount_risked

change_price_percent = (unrealized_pnl + notional_value) / notional_value - 1
change_percent_price = unrealized_pnl/notional_value+ notional_value/notional_value - 1
change_percent_price = unrealized_pnl/notional_value+ 1 - 1
change_percent_price = unrealized_pnl/notional_value
The above makes me think that perhaps there was a mistake in the quoted equation?

Then, start with an equation that contains "max_leverage". There are two possibilities in your list, so perhaps try the top one first...
amount_risked = risk_per_trade * max_leverage * distance_percent
Once you use this equation, cross it off your list. Rearrange it so that you have max_leverage=<something>. Then look though the variables on the RHS. Any variables that aren't in your "inputs" list you'll have to find a formula for - then repeat the process of crossing that formula off the list, rearrange that formula to "variable=" and then substitute it into your main formula.

See what you can do, please post back with your work/ questions.
 
Top