Portfolio SnapShot v0.3Here is a Tradingview Pinescript that I call "Portfolio Snapshot". It is based on two other separate scripts that I combined, modified and simplified - shoutout to RedKTrader (Portfolio Tracker - Table Version) and FriendOfTheTrend (Portfolio Tracker For Stocks & Crypto) for their inspiration and code. I was using both of these scripts, and decided to combine the two and increase the number of stocks to 20. I was looking for an easy way to track my entire portfolio (scattered across 5 accounts) PnL on a total and stock basis. PnL - that's it, very simple by design. The features are:
1) Track PnL across multiple accounts, from inception and current day.
2) PnL is reported in two tables, at the portfolio level and individual stock level
3) Both tables can be turned on/off and placed anywhere on the chart.
4) Input up to 20 assets (stocks, crypto, ETFs)
The user has to manually calculate total shares and average basis for stocks in multiple accounts, and then inputs this in the user input dialog. I update mine as each trade is made, or you can just update once a week or so.
I've pre-loaded it with the major indices and sector ETFs, plus URA, GLD, SLV. 100 shares of each, and prices are based on the close Jan 2 2024. So if you don't want to track your portfolio, you can use it to track other things you find interesting, such as annual performance of each sector.
Portfoliotracker
Portfolio TableA tool to manage your invested assets (stocks, crypto currencies, ...).
- Show profit of every asset as well as the total profit.
- Show/hide a bought price line on the chart if the current selected ticker is on your portfolio.
Portfolio Tracker For Stocks & CryptoThis is a portfolio tracker that will track individual, overall and daily profit/loss for up to 12 assets. You can set the size of your buys and price of your buys for accurate, up to date profit and loss data right on your chart. It works on all markets and timeframes.
HOW TO USE
Go into the indicator settings and you will see all of the available settings. The first is the ability to turn the tracker info table on or off from the chart, so it saves your portfolio info but let’s you remove it from the chart while trading. Second is the option to move the position of the info table to suit your preference.
Next we get into setting up your portfolio tickers, order size and price. Each ticker lets you set which stock/crypto you bought, then set how much you purchased and then what price you purchased them at.
Go through and set up all of your assets and then turn off any tickers that you don’t need. Once that is all done, your portfolio will be shown on the chart with all the data.
FEATURES
Top Section
The portfolio tracker has 2 sections. The top section shows each ticker in your portfolio individually with the following data:
- Ticker Name
- Weight of that asset compared to your total portfolio in %
- Current value of that position in $
- Profit or loss value from purchase price in %
- Todays change in value from yesterday’s close in %
The $ Value, PnL % and Today % will all change colors from green to red depending if they are in profit or not.
Bottom Section
The bottom section of the tracker will give you info for your portfolio as a whole. It has the following data:
- Total cost of your entire portfolio in $
- Current value of your entire portfolio in $
- Current profit or loss of your entire portfolio in $
- Current profit or loss of your entire portfolio in %
- Todays change of your entire portfolio value compared to yesterday’s close in %
The $ Value, PnL $, PnL % and Today % will all change colors from green to red depending if they are in profit or not.
Portfolio PerformanceThis indicators will help you to compute portfolio performance and display results with a stats table and a nice monthly chart.
In this script you can do following:
Compose portfolio with up to 15 instruments
Change Initial capital / date range / rebalancing period
Compare portfolio performance with a benchmark
Compute basic stats
Compute instruments contribution
Display monthly performance of portfolio and benchmark
Change style for almost everything you see on your chart
Hope it will be useful for you!
Thanks to @MUQWISHI for helping me coding it.
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.
Portfolio Performance - Effects of RebalancingFunction:
- Can be used to evaluate the performance of a portfolio containing 2 assets over a set time interval
- Shows the % return of the portfolio over the time interval defined by the user
- Includes a threshold rebalancing algorithm to show the effects that rebalancing has on the portfolio over the long term
- Created to evaluate of the performance of portfolios containing different weightings of stocks and bonds over time assuming that the user would rebalance the portfolio when asset weights crossed a threshold
Instructions:
- To be used with dividends adjustments turned on
- Add this script to a symbol. e.g. AMEX:SPY
- Click the chart to define the entry time and the exit time. i.e. the time interval
- Define the initial investment of the portfolio. Default setting is $100,000
- Define the second asset to be included in the portfolio. e.g. BATS:AGG
- The strategy comes pre-populated with a portfolio that has a weight of 80% asset 1 and 20% asset 2. i.e. 80% AMEX:SPY and 20% BATS:AGG if the symbols mentioned above were chosen
- The 7 lines show the weighted % return of each portfolio over the time period defined by the user
- Each line (except the blue) is the return based on a different rebalancing threshold. The default settings are 1%, 2.5%, 5%, 10%, 15%, 20%, 30%
- The blue line is the % return of a portfolio that was made up of 100% asset 1 over the time interval. i.e. 100% AMEX:SPY
- Asset weights and rebalancing thresholds are adjustable via the settings
- Each plot can be turned on and turned off via a tick box in the settings
Portfolio Performance - 2 AssetsFunction:
- Can be used to evaluate the performance of portfolios containing 2 assets over a set time interval
- Created to evaluate of the performance of portfolios containing different weightings of stocks and bonds over time
- Shows the % return of each portfolio over the time interval defined by the user
- Capable of showing the risk adjusted % return of each portfolio over the time interval defined by the user (setting turned off by default)
Instructions:
- To be used with dividends adjustments turned on
- Add this script to a symbol. e.g. NASDAQ:BND
- Click the chart to define the entry time and the exit time. i.e. the time interval
- Define the second asset to be included in the portfolio. e.g. AMEX:VOO
- The strategy comes pre-populated with 6 portfolios with the most common stock/bond weightings (100% stocks/0% bonds, 80% stocks/20% bonds, 60% stocks/40% bonds, et cetera)
- The 6 lines show the weighted % return of each portfolio over the time period defined by the user
- All asset weights are adjustable via the settings
- Each plot can be turned on and turned off via a tick box in the settings
- There are 6 plots that show the risk adjusted returns of each portfolio (setting turned off by default)
RedK_Portfolio Tracker v2: few enhancements and display optionsThis is an update for the PTracker v1 that I published couple of days ago. wanted to publish this as a separate script to get a chance to show how the new Portfolio Summary Infobox can be displayed on the price chart as an option. In my opinion, that info box is the most important element in this tool and that's the piece i was most looking for.
quick note here: you can track your portfolio (if not so many positions) by entering something like (without the brackets) in TradingView's chart symbol area - TradingView will resolve these symbols and chart the total -- there's a nice post by our friend @boji1 about this in a lot more details - however, that wouldn't show the stats that i need to look at to track my portfolio on daily basis.
i also made couple of other enhancements, like adding the ability to include "free cash" in the portfolio - While this free cash value will impact the Total P/L and P/L %, as part of the overall portfolio (and the denominator), it will not impact the "cost of positions" or the (current) "value of positions" -- also "Cash" will not count towards the total 10 positions that we can track with this tool.
Using Portfolio Tracker as a floating panel on the price chart
====================================================
By default, when the Portfolio Tracker is added to the chart, it will occupy its own lower panel like the picture above.
if your charts are already busy (like mine :)) - you most probably already have a couple of lower studies and it's crowded there.
in this case, you can use the Object Tree tool after adding the PTracker, to drag it onto the price panel, or you can also do that by right-clicking on the infobox and choose to move up to the price panel.
when you do that, remember to also use the Style settings of PTracker to hide both Portfolio and PnL plots, and choose Scale = no scale - this way you get the infobox to work like a floating panel on the price chart
here's a screenshot that shows this scenario - also shows how the infobox color can be easily changed from the PTracker settings to suit your chart background and for best visibility
i hope this is useful in your trading - i look forward to @TradingView team surprising us with a real portfolio tracking capability soon :)
good luck.