OPEN-SOURCE SCRIPT
RPT Position Sizer

🎯 Purpose
This indicator is a position sizing and stop-loss calculator designed to help traders instantly determine:
How many shares/contracts to buy,
How much risk (₹) they are taking per trade,
How much capital will be deployed, and
The precise stop-loss price level based on user-defined parameters.
It displays all key values in a compact on-chart table (bottom-left corner) for quick trade planning.
💡 Use Case
Perfect for discretionary swing traders, systematic position traders, and risk managers who want instant visual feedback of trade sizing metrics directly on the chart — eliminating manual calculations and improving discipline.
⚙️ Key Features
Dynamic Inputs
Trading Capital (₹) — total available capital for trading.
RPT % — risk-per-trade as a percentage of total capital.
SL % — stop-loss distance in percent below CMP (Current Market Price).
CMP Source — can be linked to close, hl2, etc.
Rounding Style — round position size to Nearest, Floor, or Ceil.
Decimals Show — control number formatting precision in the table.
Core Calculations
SL Points: CMP × SL%
SL Price: CMP − SL Points
Risk Amount (₹): Capital × RPT%
Position Size: Risk ÷ SL Points
Capital Used: Position Size × CMP
Clean On-Chart Table Display
Displays:
Trading Capital
RPT %
Risk Amount (₹)
Position Size (shares/contracts)
Capital Required (₹)
Stop-Loss % & SL Price
The table uses a minimalistic white-on-black design with clear labeling and rupee formatting for quick reference.
Data Window Integration
Plots hidden values (Position Size, Risk Amount, SL Points, Capital Used) for use in TradingView’s Data Window—ideal for strategy testing and exporting values.
This indicator is a position sizing and stop-loss calculator designed to help traders instantly determine:
How many shares/contracts to buy,
How much risk (₹) they are taking per trade,
How much capital will be deployed, and
The precise stop-loss price level based on user-defined parameters.
It displays all key values in a compact on-chart table (bottom-left corner) for quick trade planning.
💡 Use Case
Perfect for discretionary swing traders, systematic position traders, and risk managers who want instant visual feedback of trade sizing metrics directly on the chart — eliminating manual calculations and improving discipline.
⚙️ Key Features
Dynamic Inputs
Trading Capital (₹) — total available capital for trading.
RPT % — risk-per-trade as a percentage of total capital.
SL % — stop-loss distance in percent below CMP (Current Market Price).
CMP Source — can be linked to close, hl2, etc.
Rounding Style — round position size to Nearest, Floor, or Ceil.
Decimals Show — control number formatting precision in the table.
Core Calculations
SL Points: CMP × SL%
SL Price: CMP − SL Points
Risk Amount (₹): Capital × RPT%
Position Size: Risk ÷ SL Points
Capital Used: Position Size × CMP
Clean On-Chart Table Display
Displays:
Trading Capital
RPT %
Risk Amount (₹)
Position Size (shares/contracts)
Capital Required (₹)
Stop-Loss % & SL Price
The table uses a minimalistic white-on-black design with clear labeling and rupee formatting for quick reference.
Data Window Integration
Plots hidden values (Position Size, Risk Amount, SL Points, Capital Used) for use in TradingView’s Data Window—ideal for strategy testing and exporting values.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
סקריפט קוד פתוח
ברוח TradingView אמיתית, היוצר של הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יכולים לבדוק ולאמת את הפונקציונליות שלו. כל הכבוד למחבר! למרות שאתה יכול להשתמש בו בחינם, זכור שפרסום מחדש של הקוד כפוף לכללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.