OPEN-SOURCE SCRIPT
تم تحديثه Crypto Perp Calc v1

Advanced Perpetual Position Calculator for TradingView
Description
A comprehensive position sizing and risk management tool designed specifically for perpetual futures trading. This indicator eliminates the confusion of calculating leveraged positions by providing real-time position metrics directly on your chart.
Key Features:
Perfect for traders using perpetual futures who need precise position sizing with leverage.
---------
How to Use
Quick Start (3 Clicks)
1. Add the indicator to your chart
2. Click three times when prompted:
3. Read the TOTAL LOTS value from the info table (highlighted in yellow)
4. Use this lot size in your exchange when placing the trade
Detailed Setup
Step 1: Configure Your Account
Step 2: Set Price Levels
Step 3: Read the Results
The info table shows:
Step 4: Advanced Features (Optional)
Multiple Entries (DCA):
Multiple Take Profits:
Visual Elements
Alerts
Set price alerts for:
Tips for Best Results
Example Workflow
This tool bridges the gap between TradingView charting and exchange execution, ensuring your position sizing is always accurate when trading with leverage.
Disclaimer, this was coded with help of AI, double check calculations if they are off.
Description
A comprehensive position sizing and risk management tool designed specifically for perpetual futures trading. This indicator eliminates the confusion of calculating leveraged positions by providing real-time position metrics directly on your chart.
Key Features:
- Interactive Price Selection: Click directly on chart to set entry, stop loss, and take profit levels
- Accurate Lot Size Calculation: Instantly calculates the exact position size needed for your margin and leverage
- Multiple Entry Support: DCA into positions with up to 3 entry points with customizable allocation
- Multiple Take Profit Levels: Scale out of positions with up to 3 TP targets
- Comprehensive Risk Metrics: Shows dollar P&L, account risk percentage, and liquidation price
- Visual Risk/Reward: Color-coded boxes and lines display your trade setup clearly
- Real-time Info Table: All critical position data in one organized panel
Perfect for traders using perpetual futures who need precise position sizing with leverage.
---------
How to Use
Quick Start (3 Clicks)
1. Add the indicator to your chart
2. Click three times when prompted:
- First click: Set your entry price
- Second click: Set your stop loss
- Third click: Set your take profit
3. Read the TOTAL LOTS value from the info table (highlighted in yellow)
4. Use this lot size in your exchange when placing the trade
Detailed Setup
Step 1: Configure Your Account
- Enter your account balance (total USDT in account)
- Set your margin amount (how much USDT to risk on this trade)
- Choose your leverage (1x to 125x)
- Select Long or Short position
Step 2: Set Price Levels
- Main levels use interactive clicking (Entry, SL, TP)
- For multiple entries or TPs, use the settings panel to manually input prices and percentages
Step 3: Read the Results
The info table shows:
- TOTAL LOTS - The position size to enter on your exchange
- Margin Used - Your actual capital at risk
- Notional - Total position value (margin × leverage)
- Max Risk - Dollar amount you'll lose at stop loss
- Total Profit - Dollar amount you'll gain at take profit
- R:R Ratio - Risk to reward ratio
- Account Risk - Percentage of account at risk
- Liquidation - Price where position gets liquidated
Step 4: Advanced Features (Optional)
Multiple Entries (DCA):
- Enable "Use Multiple Entries"
- Set up to 3 entry prices
- Allocate percentage for each (must total 100%)
- See individual lot sizes for each entry
Multiple Take Profits:
- Enable "Use Multiple TPs"
- Set up to 3 TP levels
- Allocate percentage to close at each level (must total 100%)
- View profit at each target
Visual Elements
- Blue lines/labels: Entry points
- Red lines/labels: Stop loss
- Green lines/labels: Take profit targets
- Colored boxes: Visual risk (red) and reward (green) zones
- Info table: Can be positioned anywhere on screen
Alerts
Set price alerts for:
- Entry zones reached
- Stop loss approached
- Take profit levels hit
- Works with TradingView's alert system
Tips for Best Results
- Always verify the lot size matches your intended risk
- Check the liquidation price stays far from your stop loss
- Monitor the account risk percentage (recommended: keep under 2-3%)
- Use the warning indicators if risk exceeds margin
- For quick trades, use single entry/TP; for complex strategies, use multiple levels
Example Workflow
- Find your trade setup using your analysis
- Add this indicator and click to set levels
- Check risk metrics in the table
- Copy the TOTAL LOTS value
- Enter this exact position size on your exchange
- Set alerts for key levels if desired
This tool bridges the gap between TradingView charting and exchange execution, ensuring your position sizing is always accurate when trading with leverage.
Disclaimer, this was coded with help of AI, double check calculations if they are off.
ملاحظات الأخبار
**Crypto Perp Calc Pro - Advanced Perpetual Position Calculator**A comprehensive position sizing and risk management tool designed specifically for perpetual futures trading. This professional-grade indicator eliminates complex calculations by providing real-time position metrics directly on your chart.
**🆕 NEW FEATURES (v2.0):**
- Weighted average entry and exit prices for multiple levels
- Individual TP ROI metrics for better profit planning
- Enhanced label formatting with consistent prefixes (SL:, TP1:, TP2:, TP3:)
- Customizable line extension modes (From Entries/Current Bar/Full Chart/Custom)
- Compact label mode for cleaner charts
- Improved lot size display with consistent 4 decimal places
- Gradient visual effects for multiple TP levels
- Overall R:R and ROI prominently displayed
**📊 KEY FEATURES:**
- **Interactive Price Selection:** Click directly on chart to set entry, stop loss, and take profit levels
- **Accurate Lot Size Calculation:** Instantly calculates exact position size for your margin and leverage
- **Multiple Entry Support:** DCA into positions with up to 3 entry points with customizable allocation
- **Multiple Take Profit Levels:** Scale out of positions with up to 3 TP targets
- **Comprehensive Risk Metrics:** Shows dollar P&L, ROI percentages, account risk, and liquidation price
- **Visual Risk/Reward:** Color-coded boxes and lines display your trade setup clearly
- **Real-time Info Table:** All critical position data in one organized, professional panel
**⚡ QUICK START (3 CLICKS):**
1. Add indicator to chart
2. Click three times when prompted:
• First click: Set entry price
• Second click: Set stop loss
• Third click: Set take profit
3. Read TOTAL LOTS from info table (highlighted in yellow)
4. Enter this exact size on your exchange
**📋 DETAILED SETUP:**
*Step 1: Configure Account*
- Account Balance: Total USDT in account
- Margin: USDT amount to risk on trade
- Leverage: 1x to 300x
- Position: Long or Short
*Step 2: Set Price Levels*
- Main levels: Interactive clicking (Entry, SL, TP)
- Multiple entries/TPs: Use settings panel for prices and percentages
*Step 3: Read the Results*
Info table displays:
- TOTAL LOTS - Position size for exchange
- Avg Entry/Exit - Weighted average prices
- Max Risk - Dollar loss at stop
- Total Profit - Dollar gain at targets
- Overall R:R - Complete strategy risk/reward
- Overall ROI - Total return on margin
- Individual TP ROIs - Profit at each level
- Account Risk % - Percentage at risk
- Liquidation - Liquidation price (cross margin)
**🎯 ADVANCED FEATURES:**
*Multiple Entries (DCA):*
- Enable "Use Multiple Entries"
- Set up to 3 entry prices with allocation %
- View individual lot sizes per entry
- See weighted average entry price
*Multiple Take Profits:*
- Enable "Use Multiple TPs"
- Set up to 3 TP levels with exit %
- View individual ROI for each TP
- See weighted average exit price
*Display Customization:*
- Line Extension Modes: Control how far lines extend
- Compact Labels: Minimal info for cleaner charts
- Text Size Options: Tiny/Small/Normal/Large
- Table Position: Place info table anywhere
- Color Customization: Full control over visual theme
**📈 VISUAL ELEMENTS:**
- Blue: Entry points and info
- Orange: Average entry/exit levels
- Red: Stop loss and risk zone
- Green: Take profits with gradient effect (lighter to darker)
- Info Table: Professional metrics display
**🔔 ALERTS:**
Set alerts for:
- Entry zones reached
- Stop loss approached
- Individual TP levels hit
- Works with TradingView's alert system
**💡 PRO TIPS:**
1. Verify lot size matches intended risk
2. Keep liquidation price far from stop loss
3. Monitor account risk % (recommended: <2-3%)
4. Use warning indicators if risk exceeds margin
5. Check entry/TP percentages sum to 100%
**📱 EXAMPLE WORKFLOW:**
1. Analyze and find trade setup
2. Add indicator and click to set levels
3. Review risk metrics in table
4. Note the TOTAL LOTS value (yellow highlight)
5. Enter exact position size on exchange
6. Set alerts for key levels
**⚠️ RISK WARNINGS:**
- Table shows warnings if entry/TP percentages ≠ 100%
- Red highlight if max risk exceeds margin
- Account risk percentage color-coded (green/orange/red)
- Liquidation price clearly displayed
This perp calc tool bridges the gap between TradingView analysis and exchange execution, ensuring precise position sizing for leveraged perpetual futures trading.
**Version:** 2.0
**Author:** bujayjay
**License:** Mozilla Public License 2.0
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.