OPEN-SOURCE SCRIPT
Calculateur de Lot Interactif

By Yassine
Maximize your trading discipline and eliminate manual math with this professional-grade, interactive risk calculator built entirely in Pine Script v6.
Stop over-leveraging or guessing your lot sizes. With just two clicks directly on your chart, this indicator instantly calculates your exact position size, projects partial take profits, factors in broker commissions, and runs real-time margin diagnostics.
Key Features
🎯 100% Interactive (2-Click Setup): Simply click your Entry Price (EP) and Stop Loss (SL) directly on the screen. Drag the anchor points to adjust your trade in real-time.
📊 Multi-Asset Smart Detection: Automatically detects whether you are trading Forex (Lots), Gold / XAUUSD (Standard MT contracts), Indices/CFDs (Contracts), or Crypto/Stocks (Units), applying the exact contract specifications for flawless math.
💸 Smart Commission Deduction: Enter your broker's commission per lot, and the script automatically downscales your position size. This ensures your maximum loss (SL + Fees) remains strictly at your defined risk percentage (e.g., exactly $500 on a $50k account).
📈 Multi-Stage Take Profits (TP1 & TP2): * TP1: Set a custom RR ratio (e.g., 1:1) and define the % of the position you want to close (e.g., 50% to secure the trade).
TP2: Define your final target.
The dashboard calculates the exact price levels and potential cash gains for each stage.
⚠️ Margin & Leverage Diagnostic: Enter your account’s maximum leverage. The script checks the nominal value of your trade and flashes a red alert (⚠️ INSUFFICIENT LEVERAGE) if the required margin exceeds your available capital.
⚡ Pine Script v6 Optimized: Clean, modern code using persistent variables to prevent chart lag, flickering, and memory leaks.
Maximize your trading discipline and eliminate manual math with this professional-grade, interactive risk calculator built entirely in Pine Script v6.
Stop over-leveraging or guessing your lot sizes. With just two clicks directly on your chart, this indicator instantly calculates your exact position size, projects partial take profits, factors in broker commissions, and runs real-time margin diagnostics.
Key Features
🎯 100% Interactive (2-Click Setup): Simply click your Entry Price (EP) and Stop Loss (SL) directly on the screen. Drag the anchor points to adjust your trade in real-time.
📊 Multi-Asset Smart Detection: Automatically detects whether you are trading Forex (Lots), Gold / XAUUSD (Standard MT contracts), Indices/CFDs (Contracts), or Crypto/Stocks (Units), applying the exact contract specifications for flawless math.
💸 Smart Commission Deduction: Enter your broker's commission per lot, and the script automatically downscales your position size. This ensures your maximum loss (SL + Fees) remains strictly at your defined risk percentage (e.g., exactly $500 on a $50k account).
📈 Multi-Stage Take Profits (TP1 & TP2): * TP1: Set a custom RR ratio (e.g., 1:1) and define the % of the position you want to close (e.g., 50% to secure the trade).
TP2: Define your final target.
The dashboard calculates the exact price levels and potential cash gains for each stage.
⚠️ Margin & Leverage Diagnostic: Enter your account’s maximum leverage. The script checks the nominal value of your trade and flashes a red alert (⚠️ INSUFFICIENT LEVERAGE) if the required margin exceeds your available capital.
⚡ Pine Script v6 Optimized: Clean, modern code using persistent variables to prevent chart lag, flickering, and memory leaks.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน