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)
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
Sharing my journey to consistent futures trading | Win or lose | Learning together | Developing algorithmic strategies
إخلاء المسؤولية
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
Sharing my journey to consistent futures trading | Win or lose | Learning together | Developing algorithmic strategies
إخلاء المسؤولية
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.