PROTECTED SOURCE SCRIPT
Mis à jour

Liq level to Entry Calculator

1 181
This script calculates long and short entry levels with leverage and liquidation levels of your choosing. Suppose you are trading XBTUSD and believe the bottom is in. You're looking for a long entry using 10x leverage that will only get liquidated if we hit new lows. You choose "5698.9" USD.

snapshot

By changing the leverage to "10" and the long liquidation price to "5698.9", the script will calculate the price point for your long entry.

snapshot

I hope this helps inform your trades.

-Sim
Notes de version
//version=3
study("Liq level to Entry Calculator")
//
plot(close, color = black, linewidth = 2, title = "Close")
leverage = input(10, title = "Leverage")
CalculateLongEntry = input(false, title = "Calculate Long Entry?")
CalculateShortEntry = input(false, title = "Calculate Short Entry?")
//Long Calculator
longliqlevel = input(0, title = "Long Liquidation Level")
denominator = leverage*((1/leverage) - (1/pow(leverage, 2)))
LongEntry = longliqlevel/denominator
plot(CalculateLongEntry?LongEntry:na, color = #247BA0, title = "Long Entry")
plotchar(barstate.islast and CalculateLongEntry?LongEntry:na, color = #247BA0, size=size.auto, location=location.absolute)
plot(CalculateLongEntry?longliqlevel:na, color = #D72946, title = "Long Liquidation Level at X Leverage")
//Short Calculator
shortliqlevel = input(0, title = "Short Liquidation Level")
denominator2 = leverage*((1/leverage) + (1/pow(leverage, 2)))
ShortEntry = shortliqlevel/denominator2
plotchar(barstate.islast and CalculateShortEntry?ShortEntry:na, color = #FC5B03, size=size.auto, location=location.absolute)
plot(CalculateShortEntry?ShortEntry:na, color = #FC5B03, title = "Short Entry")
plot(CalculateShortEntry?shortliqlevel:na, color = #07135B, title = "Short Liquidation Level at X Leverage")

plotshape(leverage==100 and barstate.islast and CalculateLongEntry?longliqlevel:na, style=shape.flag, color = red, location=location.absolute, text="100x")
plotshape(leverage==50 and barstate.islast and CalculateLongEntry?longliqlevel:na, style=shape.diamond, color = red, location=location.absolute, text="50x")
plotshape(leverage==25 and barstate.islast and CalculateLongEntry?longliqlevel:na, style=shape.circle, color = red, location=location.absolute, text="25x")
plotshape(leverage==10 and barstate.islast and CalculateLongEntry?longliqlevel:na, style=shape.xcross, color = red, location=location.absolute, text="10x")
plotshape(leverage==5 and barstate.islast and CalculateLongEntry?longliqlevel:na, style=shape.triangleup, color = red, location=location.absolute, text="5x")


plotshape(leverage==100 and barstate.islast and CalculateShortEntry?shortliqlevel:na, style=shape.flag, color = #07135B, location=location.absolute, text="100x")
plotshape(leverage==50 and barstate.islast and CalculateShortEntry?shortliqlevel:na, style=shape.diamond, color = #07135B, location=location.absolute, text="50x")
plotshape(leverage==25 and barstate.islast and CalculateShortEntry?shortliqlevel:na, style=shape.circle, color = #07135B, location=location.absolute, text="25x")
plotshape(leverage==10 and barstate.islast and CalculateShortEntry?shortliqlevel:na, style=shape.xcross, color = #07135B, location=location.absolute, text="10x")
plotshape(leverage==5 and barstate.islast and CalculateShortEntry?shortliqlevel:na, style=shape.triangleup, color = #07135B, location=location.absolute, text="5x")
Notes de version
Added a feature; the option to choose separate long and short leverages.

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.