OPEN-SOURCE SCRIPT
Auto Position Calculator

A position sizing tool that automatically detects the instrument you're trading and calculates the correct position size based on your risk parameters.
What It Does
This indicator calculates how many contracts, lots, or shares to trade based on your account size, risk percentage, and stop loss distance. It auto-detects the instrument type and adjusts the point/pip value accordingly.
Supported Instruments
Futures: NQ, MNQ, ES, MES, YM, MYM, RTY, M2K, CL, MCL, GC, MGC
Forex: All major pairs (USD, EUR, GBP, JPY, etc.)
Index CFDs: NAS100, US500, US30, GER40, UK100
Metals: XAU, XAG
Crypto and Stocks: Automatic detection
How to Use
Set your account size and risk % in settings
Click the settings icon and place Entry, Stop Loss, and Take Profit on the chart
The position size and risk calculations appear automatically
Levels auto-reset at your chosen session (Asia, London, or New York open)
Limitations
CFD and forex pip values assume standard lot sizing - your broker may differ
Auto-detection relies on ticker naming conventions, which vary by broker/data feed
Session reset times are based on ET (Eastern Time)
What It Does
This indicator calculates how many contracts, lots, or shares to trade based on your account size, risk percentage, and stop loss distance. It auto-detects the instrument type and adjusts the point/pip value accordingly.
Supported Instruments
Futures: NQ, MNQ, ES, MES, YM, MYM, RTY, M2K, CL, MCL, GC, MGC
Forex: All major pairs (USD, EUR, GBP, JPY, etc.)
Index CFDs: NAS100, US500, US30, GER40, UK100
Metals: XAU, XAG
Crypto and Stocks: Automatic detection
How to Use
Set your account size and risk % in settings
Click the settings icon and place Entry, Stop Loss, and Take Profit on the chart
The position size and risk calculations appear automatically
Levels auto-reset at your chosen session (Asia, London, or New York open)
Limitations
CFD and forex pip values assume standard lot sizing - your broker may differ
Auto-detection relies on ticker naming conventions, which vary by broker/data feed
Session reset times are based on ET (Eastern Time)
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Sharing my journey to consistent futures trading | Win or lose | Learning together | Developing algorithmic strategies
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.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Sharing my journey to consistent futures trading | Win or lose | Learning together | Developing algorithmic strategies
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.