OPEN-SOURCE SCRIPT
Position Size Tool

Position Size Tool
What it does:
Shows a small on-chart table that converts per-ticker dollar amounts into share counts (shares = amount ÷ current price) for up to 4 configurable tickers.
Inputs (indicator settings)
What the table displays
How to use
Notes
Example of how to use this tool:
Monitor an index and execute trades on leveraged derivative products. This tool will determine the quantity of shares that can be purchased with a pre-determined dollar amount. Ex: Monitor SPX for entry/exit signals and execute trades on UPRO/SPXU/SPXL/SPXS.
Input a ticker and a dollar amount for position size, shares that can be purchased will be calculated based on the current asset price.
This tool can be helpful for those that use multiple platforms simultaneously to monitor and execute trades.
What it does:
Shows a small on-chart table that converts per-ticker dollar amounts into share counts (shares = amount ÷ current price) for up to 4 configurable tickers.
Inputs (indicator settings)
- Ticker 1–4 — select the symbol (TradingView will show the exchange-qualified form like BATS:TQQQ in the settings).
- Ticker N $ Amount — dollar amount to convert into shares for that ticker.
- Show Ticker N — toggle each row on/off.
- Table Text Color — color of the table text.
- Table Position — screen location (Top/ Middle/ Bottom × Left/Center/Right).
- Font Size — Small / Medium / Large.
- Show Empty Top Row — optional spacer row.
What the table displays
- Left column: the ticker symbol only (the script strips the exchange prefix for display, so BATS:TQQQ appears as TQQQ in the table).
- Right column: the calculated share count, formatted to two decimal places (or "—" if price is not available or zero).
- Table updates on the chart’s timeframe using live/last bar prices.
How to use
- Add the indicator to a chart.
- Open the indicator’s settings panel.
- In Ticker 1–4, type/select the symbols you want (you may see the exchange prefix there; that’s TradingView’s UI).
- Enter the dollar amounts for each ticker.
- Use Show Ticker N to hide/show rows.
- Adjust text color, font size, and table position as desired.
Notes
- The settings field will always show the exchange-qualified symbol (TradingView behavior); the script strips the exchange only for the on-chart display.
- If the selected symbol has no price data on the chart/timeframe, the table shows "—".
- Shares are computed as amt ÷ current close from the requested symbol and timeframe.
Example of how to use this tool:
Monitor an index and execute trades on leveraged derivative products. This tool will determine the quantity of shares that can be purchased with a pre-determined dollar amount. Ex: Monitor SPX for entry/exit signals and execute trades on UPRO/SPXU/SPXL/SPXS.
Input a ticker and a dollar amount for position size, shares that can be purchased will be calculated based on the current asset price.
This tool can be helpful for those that use multiple platforms simultaneously to monitor and execute trades.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.