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.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.