OPEN-SOURCE SCRIPT
Live Portfolio P&L

This script calculates live P&L (Profit & Loss) for up to 40 instruments — stocks, ETFs, options, futures, and Forex pairs supported by TradingView. Instead of juggling numerous inputs, you paste your portfolio in CSV format into a single text field, and the script handles the rest. It parses each position and displays a comprehensive table showing the symbol, current price, position value, total P&L, and today’s P&L—all updated in real time.
Key Features
CSV is consumed in the following format:
For example:
Pine Script®
Planned Enhancements
Questions for You
Feel free to share your thoughts and suggestions. Your feedback will help shape future updates and make this tool even more helpful for traders like you!
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.
Key Features
- CSV Portfolio Input – Effortlessly import all your positions at once without filling in multiple fields. You can export the position from your broker, save it in the required format, and paste it into this script.
- Supports Various Asset Classes – Works with any instrument that TradingView provides data for, including futures, options, and Forex.
- Up to 40 Instruments – Track a broad and diverse set of holdings in one place.
- Real-Time Updates – Get immediate feedback on live price changes, total value, and current P&L.
- Today’s P&L – Monitor your daily performance to gauge short-term trends.
CSV is consumed in the following format:
- Symbol (supported TradingView instruments)
- Entry Price
- Quantity (negative for short position)
- Lot Size (for futures/options, it might not be one)
For example:
AAPL,237,100,1
TSLA,400,-150,1
ESM2025,6000,5,50
Planned Enhancements
- Multi-Currency Support – Automatically convert and display your positions’ values in different currencies.
- Advanced Metrics – Get deeper insights with calculations for drawdown, Sharpe ratio, and more.
- Risk Management Tools – Set stop-loss and take-profit levels and receive alerts when thresholds are hit.
- Option Greeks & Margin Calculations – Manage complex option strategies and track margin requirements.
Questions for You
- What additional features would you like to see?
- Are there any specific metrics or analytics you’d find especially valuable?
- How might this script fit into your current trading workflow?
Feel free to share your thoughts and suggestions. Your feedback will help shape future updates and make this tool even more helpful for traders like you!
Disclaimer
Please remember that past performance may not be indicative of future results.
Due to various factors, including changing market conditions, the strategy may no longer perform as well as in historical backtesting.
This post and the script don’t provide any financial advice.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Quant Developer | Pine Script v6 | Python & R
12+ yrs system. trading, hedge fund experience
Custom indicators, strategies & screeners
Futures & options
💼 Hire/Consulting:
qntly.com/hire
🎓 PineScript V6 Course:
qntly.com/ps6
12+ yrs system. trading, hedge fund experience
Custom indicators, strategies & screeners
Futures & options
💼 Hire/Consulting:
qntly.com/hire
🎓 PineScript V6 Course:
qntly.com/ps6
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Quant Developer | Pine Script v6 | Python & R
12+ yrs system. trading, hedge fund experience
Custom indicators, strategies & screeners
Futures & options
💼 Hire/Consulting:
qntly.com/hire
🎓 PineScript V6 Course:
qntly.com/ps6
12+ yrs system. trading, hedge fund experience
Custom indicators, strategies & screeners
Futures & options
💼 Hire/Consulting:
qntly.com/hire
🎓 PineScript V6 Course:
qntly.com/ps6
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.