OPEN-SOURCE SCRIPT

The Ultimate Alligator Calculator

2 665
GM Blue Belts!

Welcome to The Alligator Calculator: Trading View Edition!

The calculator is easy to use.

The calculator will tell you the exact risk, expected loss and position size with leverage as well, if needed.

Just tell it your portfolio size and your desired risk and it will do all of the work for you after it has received the entry and stop loss values.

It saves the data so do not worry about having to enter your CEX settings every single time.

It should make sure that you never deviate more than 10% and that your position size fits the minimum position size allowed on your chosen CEX and Coin!

This does not mean that it is not possible to deviate too much! Super high slippage or weirdly filled orders can happen! This is on the CEX side and is not something I can do anything about.

Color adjustments are available in the settings!

The Ultimate Alligator Calculator: Quick Guide

Calculator Inputs:

Entry Price
Input the price at which you enter the trade.

Stop Loss Price
Input the price at which you will exit the trade to limit losses.

Portfolio Size
Input the total size of your trading portfolio.

Desired Risk
Input the amount of risk you are willing to take.

CEX Settings:

Entry Fee (%)
Input the fee percentage for entering a trade.

Exit Fee (%)
Input the fee percentage for exiting a trade.

Minimum Position Size
Specify the smallest allowable position size.

Advanced Settings:

Leverage Buffer
Input a buffer value for leverage calculations.

Upside Deviation Allowed (%)
Set the maximum acceptable increase in risk as a percentage.

Downside Deviation Allowed (%)*
Set the maximum acceptable decrease in risk as a percentage.

Calculator Outputs:

Risk
Displays either the desired risk or adjusted risk based on the validity check.
This is your RISK and the one you input into your trading sheet!

Expected Loss
Displays the Final Expected Loss and it is the one you input into your trading sheet!

Position Size
Displays the Final Position Size and it is the one you input into your trading sheet!

Leverage
Determines the leverage needed if the notional value exceeds the portfolio size, ensuring sufficient leverage is maintained.

Notional Value
Computes the total value of the position based on the entry price.

Calculations:

Price Move
Calculates the price difference between the entry and stop-loss price.

Initial Fees
Computes the initial cost of entering and exiting a trade.

Initial Notional Values
Calculates the initial total value of the position based on entry price.

Initial Expected Loss
Estimates potential loss considering fees and price move.

Initial Position Size
Determines the size of the initial position based on expected loss and price move.

Adjusted Position Size
Rounds the initial position size to the nearest allowable size.

Adjusted Expected Loss
Recalculates potential loss based on the adjusted position size.

Adjusted Notional Value
Updates the total value of the position considering the adjusted size.

Adjusted Fees (USD)
Recomputes the fees based on the adjusted notional value.

Adjusted Risk
Calculates the total risk by adding adjusted expected loss and fees.

Valid Risk?
Verifies if the adjusted risk is within the allowed deviation limits of the desired risk.

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.