OPEN-SOURCE SCRIPT
Realtime Position Calculator

Risk management is the single most important factor in trading success. This indicator automates the process of position sizing in real-time based on your account risk and a dynamic technical Stop Loss. It eliminates the need for manual calculations and helps you execute trades faster while adhering to strict risk management rules.
How it Works
The indicator visually places a Stop Loss line based on recent market structure (Highs/Lows) and instantly calculates the required position size (Contracts/Lots) to match your defined monetary risk.
1. Dynamic Stop Loss: It identifies the highest high (for Shorts) or lowest low (for Longs) over a user-defined lookback period.
2. Position Calculation: It calculates the distance between the current price and the Stop Loss level.
3. Formula: Contract Size = Risk Amount / (Distance * Point Value)
4. Actual vs. Target Risk: Because of the rounding, the script calculates and displays the Actual Risk (e.g., $95) alongside your Target Risk (e.g., $100), so you know exactly what is at stake.
Key Features
Real-time Calculation: Updates instantly as price moves.
Copy Trading Support: Includes an "Account Multiplier" setting. If you trade 10 accounts via a copy trader, set the multiplier to 10. The indicator will show the total contract size needed across all accounts.
Point Value Support: Works for Stocks/Crypto (Point Value = 1) and Futures (e.g., ES = 50, NQ = 20).
Customizable UI: Toggle specific data on/off in the label (e.g., hide price, show only contracts). Adjustable label offset to keep the chart clean.
Settings Guide
Trade Direction: Toggle between Long and Short setups. Add the indicator two times and set another for Longs and another for Shorts so you can see both direction at the same time.
Risk Amount: Your max risk in currency (e.g., $100).
Lookback: How many bars back to look for the SL pivot (e.g., 10 bars).
Point Value: Crucial for Futures. Use 1.0 for Crypto/Stocks. Use tick value/point value for futures (e.g., 50 for ES).
Account Multiplier: Multiply the position size for multiple accounts.
Label Offset: Move the information label to the right to avoid overlapping with price action.
Disclaimer
This tool is for informational and educational purposes only. Always verify calculations manually before executing trades. Past performance is not indicative of future results.
How it Works
The indicator visually places a Stop Loss line based on recent market structure (Highs/Lows) and instantly calculates the required position size (Contracts/Lots) to match your defined monetary risk.
1. Dynamic Stop Loss: It identifies the highest high (for Shorts) or lowest low (for Longs) over a user-defined lookback period.
2. Position Calculation: It calculates the distance between the current price and the Stop Loss level.
3. Formula: Contract Size = Risk Amount / (Distance * Point Value)
4. Actual vs. Target Risk: Because of the rounding, the script calculates and displays the Actual Risk (e.g., $95) alongside your Target Risk (e.g., $100), so you know exactly what is at stake.
Key Features
Real-time Calculation: Updates instantly as price moves.
Copy Trading Support: Includes an "Account Multiplier" setting. If you trade 10 accounts via a copy trader, set the multiplier to 10. The indicator will show the total contract size needed across all accounts.
Point Value Support: Works for Stocks/Crypto (Point Value = 1) and Futures (e.g., ES = 50, NQ = 20).
Customizable UI: Toggle specific data on/off in the label (e.g., hide price, show only contracts). Adjustable label offset to keep the chart clean.
Settings Guide
Trade Direction: Toggle between Long and Short setups. Add the indicator two times and set another for Longs and another for Shorts so you can see both direction at the same time.
Risk Amount: Your max risk in currency (e.g., $100).
Lookback: How many bars back to look for the SL pivot (e.g., 10 bars).
Point Value: Crucial for Futures. Use 1.0 for Crypto/Stocks. Use tick value/point value for futures (e.g., 50 for ES).
Account Multiplier: Multiply the position size for multiple accounts.
Label Offset: Move the information label to the right to avoid overlapping with price action.
Disclaimer
This tool is for informational and educational purposes only. Always verify calculations manually before executing trades. Past performance is not indicative of future results.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
- Viltsu / x.com/ViltsuFIN
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
- Viltsu / x.com/ViltsuFIN
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。