RedKTrader

Tutorial: How I Track a stock portfolio on TradingView

Educacional
For those of us who like to leverage the awesome charting capabilities of TradingView to visualize, analyze and track a portfolio of holdings, i wanted to share couple of ways i have been using in the past few months.

I found that the ability to "chart" a portfolio adds a whole new dimension to my decision making - that looking at the portfolio in numbers on daily basis does not allow. for example, when I'm able to "chart" the portfolio, i can apply simple technical analysis tools (Moving Averages, MACD ..etc) to find new "portfolio opportunities" - like for example, when the portfolio is at a top with a possible upcoming decline in value, that would be a good time to start cashing out and locking some of my unrealized profits, or to hedge by buying some Puts or selling some Covered Calls.. as in the example in the chart above.

so here the ways i use to track my portfolio using TradingView.

Method 1: Using a Pine script
- few weeks ago i published a simple Portfolio Tracker script with details on how it can be used to set up and track a simple portfolio of 10 holdings + a cash position. please refer to the link below if you're interested in that method.


Method 2: Using TradingView's Watchlist
- i'd like to focus on this method in this post. there are few variations to how this can be accomplished, and i hope i can share a trick or 2 that i have been using that made this a lot easier for me

1 - the simplest way: add the "portfolio string" manually as a watchlist symbol

assume i have a simple portfolio of 100 MSFT + 200 AAPL + 300 INTC along with some $10,000 cash in the account
i chose to add a new symbol to my watchlist, and enter the line below - this is what i refer to as the "portfolio string":

MSFT * 100 + AAPL * 200 + INTC * 300 + 10,000

and this is what you see in the chart here..

this should work well - the only issue with this method is that if my portfolio is more complex than 3-4 positions, and/or if it changes frequently due my active trading, this manual approach is less than ideal

2 - what if my portfolio is more complex than this and it changes often

in that case, i would suggest to use a spreadsheet - or maybe you already maintain a sheet where you track your trades.
in that sheet, construct a table like the below and enter the formulas that are shown in the "formula view"

in that sheet, cell D2 , will consolidate (using the concatenation function) the individual "Position Strings" into a single "Portfolio String"
you can then copy cell D2 from the Excel table, then go to TradingView, choose to add a symbol to your watchlist, and simply paste that "Portfolio String" in there.. and voila!

-- adjust the number of rows as needed (add rows, and update the formula in cell D2). i tried with more than 10 positions per portfolio and it works smoothly
-- note that the "Position_Str" formula is consistent for all holdings *except* for the last line
-- if you're using something other than Excel, please map the functions accordingly. the below works on Excel.

Formula View = what we enter in the spreadsheet
---------------------------------------------------------------------------------------------------------------	
	A	B		C				D
---------------------------------------------------------------------------------------------------------------
1 	Symbol 	Qty 		Position_str 			Portfolio_str
2 	sym1 	100 		= A2 & "*" & B2 & "+" 		=CONCAT(C2:C5)
3 	sym2 	200 		= A3 & "*" & B3 & "+"
4 	sym3 	300 		= A4 & "*" & B4 & "+"
5 	Cash 	10,000 	 	= B5
----------------------------------------------------------------------------------------------------------------

Normal Table (results) View
---------------------------------------------------------------------------------------------------------------
	A	B		C				D
---------------------------------------------------------------------------------------------------------------
1 	Symbol 	Qty 		Position_str 			Portfolio_str
2 	sym1 	100 		MSFT*2000+ 			MSFT*2000+AAPL*3000+INTC*3000+10000
3 	sym2 	200 		AAPL*3000+	
4 	sym3 	300 		INTC*3000+
5 	Cash 	10,000 	 	10,000
----------------------------------------------------------------------------------------------------------------

3 - My last tip here is not a separate approach - but builds on the one above
- i already use a separate spreadsheet table (a trade log) to track my trades which i update on regular basis.
- using the pivot table feature, i can construct a view of my "trade log" that provides what we see in Columns A and B above.
- so this makes it easy to just "refresh" the pivot table once i update my trades, and the "Portfolio String" will be updated automatically for me - theni will just copy and paste it as a new symbol in my TradingView WatchList and remove the older ones.

i hope some of you find these tips useful and can leverage some of this to open up that new portfolio management abilities to your trading..

Feedback and comments are welcome as usual - best of luck!

Comentário: i'm sorry that my tables were distorted after publishing - it seems the publishing engine removes the tabs and spaces. but i hope readers will still get the idea and leverage the example.
Comentário: thanks to the TV team for helping me fix the table - now it shows properly. TV team, you guys rock (as always)!

Comentários

Fantastic. And I need to try some of this myself
100 moedas
Resposta
RedKTrader scheplick
@scheplick, thank you S :)
Resposta
Still don't understand why TradingView doesn't provide a better tool to keep track of P&L all buy & sells on chart. What I want most
Resposta
Great content!

May I know what should I do with multiple currencies? e.g. I am holding some USD, GBP and JPY. What should I input in the table / the formula?

Thanks in advance :)
Resposta
RedKTrader wks1121
@wks1121, the "formulas" shouldn't change - it's about what symbols to use

with that said, sorry if i don't know how this may work for currencies - this was meant for a stock portfolio - maybe someone can test it in other areas and share findings ??
Resposta
This is a great tip! I have been thinking about how this could be achieved in TV for some time. I hold just under 10 stocks at the moment, so this works well. I'm will play around with the Compare function to overlay various indices on the portfolio, in addition to using a Comparative Relative Strength (vs the index) indicator. I would be great if this could support 10 more tickers...
Resposta
TFFX_ TFFX_
@TFFX_, I have noticed that this approach does seem to have some issues with tickers that are numbers (888 Holding PLC for example - 888) - any ideas on how to fix this?
Resposta
@TFFX_, try to use the full syntax exhange:symbol (for example LSE:888) -- i think the issue may happen when there's ambiguity with the symbol and it can't be uniquely resolved.
Resposta
TFFX_ RedKTrader
@RedKTrader, thanks for the note. I had tried LSE:888, 888:LSE and LSE:888., but it still seems to have an issue with it. If i have two other securities it wont calculate, but if I remove it, the other two work fine.
Resposta
@TFFX_, i got curious and tested adding any LSE symbol with a quantity doesn't work. i don't know what the reason is - i suggest you send this to Tech Support maybe they can explain.
Resposta
Início Rastreador de Fundamentos Rastreador Forex Rastreador de Criptomoedas Calendário Econômico Sobre Recursos gráficos Preços Indique um Amigo Regras da Casa Central de Ajuda Soluções para Sites & Corretoras Widgets Soluções em Gráficos Biblioteca de Gráficos Lightweight Blog & Notícias Twitter