OPEN-SOURCE SCRIPT
The Ultimate Alligator Calculator

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.
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.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, người tạo ra tập lệnh này đã biến tập lệnh thành mã nguồn mở để các nhà giao dịch có thể xem xét và xác minh công năng. Xin dành lời khen tặng cho tác giả! Mặc dù bạn có thể sử dụng miễn phí, nhưng lưu ý nếu đăng lại mã, bạn phải tuân theo Quy tắc nội bộ của chúng tôi.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.