Leverage Calculator

This script is intended to be used as a risk management calculator.
It will calculate the best leverage to use based on the maximum percentage of loss you are willing to incur on your trading portfolio.
Also calculates the order value and order qty based on your inputs.
Please note this calculator does not take into account any trading fees imposed by the exchange you are using.
*** Only risking 1% to 5% of your portfolio is considered good risk management ***

------ Settings Inputs -----------------------------------------------------------------------------------------------------
"Portfolio Size" -- enter your portfolio balance
"% Willing to lose on this trade" -- enter the percent of your portfolio you are willing to lose if the stop loss is hit
"Entry Price" -- enter the price at which you will enter the trade
"Stop Loss Price" -- enter the price at which your stop loss will be set

------ Outputs -------------------------------------------------------------------------------------------------------------
"Portfolio" -- displays the portfolio balance entered in settings
"max loss on trade" -- displays the % loss entered in settings and the corresponding amount of your portfolio
"Entry Price" -- displays the entry price entered in settings
"Stop Loss Price" -- displays the stop loss price entered in settings
"Stop Loss %" -- displays the calculated percentage loss from the entry price
"Leverage calc" -- displays the calculated leverage based on your max loss and stop loss settings
"Order Value" -- displays the value of the order based on the calculated leverage
"Order Qty" -- displays the calculated order qty based on the calculated leverage

If you find this script useful and would like to kindly leave a donation:
BTC address (native segwit): bc1quttstg4r9szp5zj0lrpyt6p6j6wqvgw0079s5r
BTC address (segwit): 3Krj4a3g4GihBxwrFjpfqAEnh44UUjEazs
ETH address: 0xC6868E1e8Df30DEFaD37462Dd2673D3AB615933b
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?