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.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.