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. اقرأ المزيد في شروط الاستخدام.