OPEN-SOURCE SCRIPT
Position Sizer

Position Sizer
A clean, lightweight position sizing calculator that lives directly on your chart. Instantly tells you how many shares to buy or sell based on your risk amount and stop loss — no more manual math before every trade.
How It Works
Set your Risk Amount ($) and Stop Loss Price in the settings. The indicator uses the live market price as your entry by default and calculates everything in real time:
Shares — exact number of shares/units to trade
Position Value — total capital deployed (shares × live price)
Direction — automatically detects LONG ▲ or SHORT ▼ based on your entry vs stop loss
Features
📌 Fixed $ Risk — enter the exact dollar amount you're willing to lose on the trade
📈 Live Price Entry — uses the current market price automatically; override anytime with a custom entry
🎯 Auto Direction — detects Long or Short from your entry/stop setup
🖥️ Fully Customizable Box — move to any corner, adjust text size, and change all colors to match your chart theme
⚡ Zero Lag — updates on every bar close in real time
Settings
Setting Description
Risk Amount ($) How much you're risking on the trade (default: $250)
Entry Price Leave at 0 to use live price, or set a specific entry
Stop Loss Price Your stop loss level
Horizontal / Vertical Position Move the box to any corner
Text Size Tiny, Small, Normal, Large
Colors Fully customizable box, border, labels, and values
How to Use
Add the indicator to your chart
Open Settings → Inputs
Set your Risk Amount and Stop Loss Price
Read your position size directly from the box on the chart
Built for traders who manage risk with a fixed dollar amount per trade. Works on Stocks and Crypto.
A clean, lightweight position sizing calculator that lives directly on your chart. Instantly tells you how many shares to buy or sell based on your risk amount and stop loss — no more manual math before every trade.
How It Works
Set your Risk Amount ($) and Stop Loss Price in the settings. The indicator uses the live market price as your entry by default and calculates everything in real time:
Shares — exact number of shares/units to trade
Position Value — total capital deployed (shares × live price)
Direction — automatically detects LONG ▲ or SHORT ▼ based on your entry vs stop loss
Features
📌 Fixed $ Risk — enter the exact dollar amount you're willing to lose on the trade
📈 Live Price Entry — uses the current market price automatically; override anytime with a custom entry
🎯 Auto Direction — detects Long or Short from your entry/stop setup
🖥️ Fully Customizable Box — move to any corner, adjust text size, and change all colors to match your chart theme
⚡ Zero Lag — updates on every bar close in real time
Settings
Setting Description
Risk Amount ($) How much you're risking on the trade (default: $250)
Entry Price Leave at 0 to use live price, or set a specific entry
Stop Loss Price Your stop loss level
Horizontal / Vertical Position Move the box to any corner
Text Size Tiny, Small, Normal, Large
Colors Fully customizable box, border, labels, and values
How to Use
Add the indicator to your chart
Open Settings → Inputs
Set your Risk Amount and Stop Loss Price
Read your position size directly from the box on the chart
Built for traders who manage risk with a fixed dollar amount per trade. Works on Stocks and Crypto.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.