OPEN-SOURCE SCRIPT
已更新 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.
版本注释
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
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。