OPEN-SOURCE SCRIPT

Lot Size Table

407
Lot Size Table Indicator – Pine Script (v5)
This TradingView script, “Lot Size Table,” creates a dynamic on-chart table that helps forex traders quickly calculate position sizes (lot sizes) for different capital and risk settings across various stop-loss (SL) pip scenarios.

🔧 Key Features:
📊 Real-time Forex Price Integration
Retrieves daily forex prices from OANDA for accurate lot size adjustments.

Instruments supported: USDJPY, USDCHF, AUDUSD, GBPUSD, NZDUSD, USDCAD, EURUSD.

🧠 Smart Lot Size Adjustments
Custom function adjustLotSize() adjusts lot sizes based on:

The currency of the instrument (e.g., JPY, GBP, AUD, etc.).

Special multiplier for symbols like US30 (e.g., ×8.5).

🧾 Flexible Capital & Risk Inputs
Supports 3 customizable capital groups, each with its own:

Capital amount

Risk percentage

📉 Multiple Stop-Loss (SL) Scenarios
Users input a comma-separated list of SL pip values (e.g., "20,25,30,...").

For each SL value, lot sizes are calculated for all 3 capital/risk combinations.

📋 Formatted On-Chart Table
Displays in a user-selected corner of the chart.

Customizable size, background color, and border.

Header row includes capital values and risk % (formatted to "k" if over 1,000).

Remaining rows show calculated lot sizes for each SL pip value.

📐 How It Works:
User Inputs: Capital, risk %, SL pip list, and table styling.

Calculation:

Lot size = (capital × risk%) / (SL pips × 10)

Adjusted based on instrument’s currency.

Display:

Table shows all SL pip scenarios and the corresponding adjusted lot sizes for each capital group.

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.