OPEN-SOURCE SCRIPT
Position Size Calculator

POSITION SIZE CALCULATOR
Calculating the exact number of shares to buy before entering a trade can be slow and distracting. This on-chart indicator does all the position sizing math for you in real time.
Simply enter your total account balance, choose your preferred allocation percentages, and the script displays an on-screen table showing the exact amount to invest and the number of whole shares to buy.
WHAT IT DOES
- Automatic Share Sizing: Calculates whole shares to buy based on your capital and allocation percentages.
- 3 Allocation Tiers: Configure 3 custom sizing options (e.g. 10%, 20%, 30%) to suit different trade setups.
- Live or Manual Price:
- By default, it takes the confirmed close price of your chosen timeframe (e.g. 5-min, Daily).
- Or toggle "Manual Entry Price" to calculate sizes for planned limit orders.
- Safe Math: Always rounds down to complete shares (math.floor) so you never exceed your intended risk.
- Clean & Flexible Display: Fully customizable table position, color themes, and an option to hide the table outside regular market hours.
HOW TO USE IT
1. Add the indicator to your chart.
2. Open Settings (the gear icon on the indicator label):
- Account: Enter your total trading capital.
- Allocation Tiers: Set your allocation percentages for Tier 1, 2, and 3.
- Price Settings: Keep automatic close price detection, or check "Use Manual Entry Price" and type your limit price.
3. Check the on-chart table:
- Find your desired tier column.
- Read the green highlighted number in the "Shares" row and place your order.
CUSTOMIZATION OPTIONS
- Show/Hide Investment Row: Display only the share count or include the cash value.
- Hide When Market Closed: Automatically hides the table when the market is inactive to keep your charts clean.
- Table Position: Move the table to any corner or side of your screen (Top-Right, Top-Left, Bottom-Right, etc.).
- Colors: Adjust background, border, text, and highlight colors to fit dark or light charts.
DISCLAIMER
This script is a position sizing calculation tool and does not provide financial advice, buy/sell signals, or trade recommendations. Always manage your risk according to your personal trading plan.
Calculating the exact number of shares to buy before entering a trade can be slow and distracting. This on-chart indicator does all the position sizing math for you in real time.
Simply enter your total account balance, choose your preferred allocation percentages, and the script displays an on-screen table showing the exact amount to invest and the number of whole shares to buy.
WHAT IT DOES
- Automatic Share Sizing: Calculates whole shares to buy based on your capital and allocation percentages.
- 3 Allocation Tiers: Configure 3 custom sizing options (e.g. 10%, 20%, 30%) to suit different trade setups.
- Live or Manual Price:
- By default, it takes the confirmed close price of your chosen timeframe (e.g. 5-min, Daily).
- Or toggle "Manual Entry Price" to calculate sizes for planned limit orders.
- Safe Math: Always rounds down to complete shares (math.floor) so you never exceed your intended risk.
- Clean & Flexible Display: Fully customizable table position, color themes, and an option to hide the table outside regular market hours.
HOW TO USE IT
1. Add the indicator to your chart.
2. Open Settings (the gear icon on the indicator label):
- Account: Enter your total trading capital.
- Allocation Tiers: Set your allocation percentages for Tier 1, 2, and 3.
- Price Settings: Keep automatic close price detection, or check "Use Manual Entry Price" and type your limit price.
3. Check the on-chart table:
- Find your desired tier column.
- Read the green highlighted number in the "Shares" row and place your order.
CUSTOMIZATION OPTIONS
- Show/Hide Investment Row: Display only the share count or include the cash value.
- Hide When Market Closed: Automatically hides the table when the market is inactive to keep your charts clean.
- Table Position: Move the table to any corner or side of your screen (Top-Right, Top-Left, Bottom-Right, etc.).
- Colors: Adjust background, border, text, and highlight colors to fit dark or light charts.
DISCLAIMER
This script is a position sizing calculation tool and does not provide financial advice, buy/sell signals, or trade recommendations. Always manage your risk according to your personal trading plan.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.