OPEN-SOURCE SCRIPT
Cập nhật Lot Size Calculator

Lot Size Calculator for Gold (XAU)
This indicator helps traders calculate the proper lot size for Gold (XAU) based on their entry, stop loss, and risk amount in USD.
You can set your entry and stop levels directly on the chart, and adjust your dollar risk from the settings panel.
The indicator measures the distance between entry and stop to calculate the position size that matches your selected risk.
A clean, customizable table displays key values such as Risk, Entry, Stop, Target, Lots, and Pips.
You can easily hide specific rows, change colors, and adjust layout options to fit your chart style.
Designed specifically for Gold traders, this tool provides a simple and visual way to manage risk directly on the chart.
This indicator helps traders calculate the proper lot size for Gold (XAU) based on their entry, stop loss, and risk amount in USD.
You can set your entry and stop levels directly on the chart, and adjust your dollar risk from the settings panel.
The indicator measures the distance between entry and stop to calculate the position size that matches your selected risk.
A clean, customizable table displays key values such as Risk, Entry, Stop, Target, Lots, and Pips.
You can easily hide specific rows, change colors, and adjust layout options to fit your chart style.
Designed specifically for Gold traders, this tool provides a simple and visual way to manage risk directly on the chart.
Phát hành các Ghi chú
Lot Size Calculator for GoldThis indicator is designed exclusively for the XAUUSD symbol and will not activate on any other instrument.
It calculates the exact lot size needed so that a trade from Entry to Stop-Loss risks exactly the USD amount specified by the user.
Calculation formula
SL distance = |Entry price − Stop-Loss price|
Lot size = Risk in USD ÷ (SL distance × 100)
Features
- Works only on XAUUSD (automatically disabled on all other symbols)
- Entry and Stop-Loss prices are set by clicking directly on the chart
- Target price is calculated automatically based on user-defined Risk:Reward ratio (default 1:1)
- Visual elements: red box (risk zone), green box (reward zone), horizontal lines for Entry/Stop/Target
- Customizable table displaying: Risk ($), Entry, Stop, Target, Lots, Pips
- Full control over table position, colors, transparency and row visibility
How to use
- Apply the indicator to any XAUUSD chart
- When the indicator is first added, two pop-ups will appear — click on the chart to set Entry price first, then click again to set Stop-Loss price
- Set your desired Risk amount in USD in the settings (default $50)
- (Optional) Adjust the "R:R" input to change the Risk:Reward ratio — Target price will update automatically (default 1:1)
- Read the calculated Lot size from the table and use that exact volume in your broker
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.