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.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。