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 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:


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.

免責聲明