boji1

Defining a single market indicator in TradingView -

Education
Defining a single market indicator in TradingView -
I thought I would share a couple things that may help others. I’m new to trading, so if anyone has any feedback, or comments, or if I got anything wrong - please let me know.
My goal was (as the bottom has been falling out of the market) to understand the relative performance of my portfolio in relation to the market. Stated differently, are my long positions down because I made bad choices, bought at the wrong time or are they a casualty of the general downturn in the markets.
As I looked at well-known market indicators:
SPX Representing the S&P-500
IXIC Representing the NASDAQ composite index
DJI Representing the Dow Jones Industrial average

I learned that the SPX represents roughly $31.6 trillion in 500-US companies, the IXIC represents $17.2 trillion in 100 large US companies, and the DJI represents $8.3 trillion in 30 of the largest US companies.
Sharing this without permission of the author:
https://bit.ly/3bf0jCU

This helped me understand the valuation, and overlap of these averages.
It’s widely understood that you can look at these indicators within charts using TradingView.
What was less-obvious to me is that TradingView is powerful in-that you can also combine multiple symbols, and perform mathematical operations using the symbol-selection dialog (command line).

VIEWING REALTIME PROFIT / LOSS VIA TRADINGVIEW:
Ford motors is on the NYSE, so you can enter: F ; Tradingview prepends the exchange and looks up: NYSE:F. Resulting in a graph of Ford motors.
But let’s say you bought 100 shares of Ford at $10.54/share and you really want TradingView to show you a graph of your profit or loss on your investment.
So your cost for this block of stock is: 100 (shares) x $10.54/share = $1,054.00
To show a graph of your profit in Tradingview, you can enter:
NYSE:F * 100 - 1054
This tells Tradingview to calculate the current value of 100 shares, and subtract your basis, of $1,054.00, resulting in a real-time view of your profit/loss.

VIEWING REALTIME PROFIT / LOSS FOR A GROUP OF HOLDINGS TRADINGVIEW:
I built an equation in Google Sheets / Excel, to create a string like this for each of my long positions.
You can concatenate multiple positions together like this. Let’s say you have a position in
NYSE:UL*182-9978.15 ; representing a position in UL
NYSE:SQ*44-9881.52 ; representing a position in SQ
NYSE:MSFT*43-9949.6 ; representing a position in MSFT
NYSE:UL*182-9978.15+NYSE:SQ*44-9881.52+NYSE:MSFT*43-9949.6 ; representing the overall profit/loss on this group

VIEWING REALTIME COMBINED MARKET PERFORMANCE VIA INDEX SUMMARY:
Similar to the process listed above, I built a spreadsheet that combines the SPX , IXIC and DJI.

So the math I used here is the market-cap of SPX / the market cap of DJI, to calculate a relative multiplier.
Based on this, you can open Tradingview, and in the stock selection dialog, enter:
TVC:SPX*3.795+TVC:IXIC*2.065+TVC:DJI
Based on this you can now view a single real-time graph showing the relative performance of the SPX , IXIC and DJI.

Hopefully this will help someone and if I got anything wrong here, please let me know (while trying to be nice).


Comment: Here is a link to a Google Sheets spreadsheet to show you how to do your own concatenation.


https://docs.google.com/spreadsheets/d/1...

Another point here is that when you are viewing the profit / loss of a single stock or a group of stocks, you can view the performance as a percentage or as a dollar-amount by changing the settings icon in the bottom of the right column of your chart.
Comment: typo above, Microsoft is on the NASDAQ
NASDAQ:MSFT*43-9949.6
and the combined line should read:
(NYSE:UL*182)-9978.15+(NYSE:SQ*44)-9881.52+(NASDAQ:MSFT*43)-9949.6

(sorry)
Comment: Another idea (seeking feedback) is to use SPY, QQQ, and DIA as proxies for overall market performance since the indicators for the SPX, IXIC, and DJI don’t include volume information. I added a section in the spreadsheet above and substituted SPY, QQQ and DIA. With this, you can view a composite of those three ETF’s and use things like MACD.

Try:
amex:SPY*3.795+NASDAQ:QQQ*2.065+AMEX:DIA

I realize the volume of these ETF’s doesn’t mirror overall volume, but it may still be useful.
Comment: I've been studying the MTTR (mean time to recover) from the March 2020 crash using this indicator.
The March 2020 crash caused a -33.7% market drop which took 166 days to recover.
Comparing that drop to other stocks, if you look at the same data for MSFT, it dropped -28% and took 119 days to recover.
Similarly ARKF, it dropped by -34.5%, but recovered in 90-days.

I think what all the naysayers are missing here in this downturn is that we will see another $2T (trillion) dollars enter the monetary supply, which will cause devaluation of the dollar. If you think of this in terms of hard assets, like shares in a company, those shares will be worth much more (in dollars) as these additional funds enter the market.

I think using this combined with something like a 50-EMA can help you from buying-in when you think you've seen the bottom but where bottom has not yet occurred.

Open the stock selector and paste this:
AMEX:SPY*3.795+NASDAQ:QQQ*2.065+AMEX:DIA

Then apply whatever functions you like.
Comment: To apply the color-alternating 50-SMA:
Add Fx
Search for: Simple Moving Averages by stocksinboxx
Add this to your chart
select properties for this function.
under Style tab at top, disable (un-check) all SMA #'s except for SMA #5
under Inputs tab, scroll down to line that reads: SMA #5, and set whatever interval you like, I have been using 50
click ok
Comment: Important note: set your data frequency to 1-hour, to achieve same results. See my other post on the relationship between SMA and data frequency.
Comment: YIKES! PLEASE READ:

I seriously apologize for this but I made a mathematical error. The concatenated string for the combined indicator should be:
TVC:SPX/3.795+TVC:IXIC/2.065+TVC:DJI

In my original post, I accidentally multiplied by the scaling factor instead of dividing. The string listed above correctly weights the three stock indexes equally. I also corrected the referenced Google Sheets spreadsheet.

Comments

Thanks for sharing this tip! We've featured it in Editors' Picks.
100 coins
+3 Reply
boji1 TradingView
@TradingView, thank you. You guys have built an amazing platform. One thing I’ve noticed when using these long concatenation strings is that when you compare multiple stock symbols, Tradingview automatically adds a label to each on the right side (each time a new one is added). In this use case, it would be nice if TV didn’t turn these on each time, to not have to turn them off each time a new stock is added for comparison.

Thank you for a great tool.
+3 Reply
You should work for Trading View
+5 Reply
super informative! I had no idea trading view had those capabilities thank you so much, you just opened Pandora's box for me
+4 Reply
I'm glad you liked it. Here is a link to a Google Sheets document that shows you how to do your own concatenation.

https://docs.google.com/spreadsheets/d/1tfmqvec9xzOtZWi7bkwHBfs11jAgmUY2t_C-g4DwWOo/edit?usp=sharing
+2 Reply
Great post - thanks!

TradingView can also calculate the total cost of a position as part of the formula:
NYSE:F*100-1054
NYSE:F*100-(10.54*100)

This is handy for numbers that aren't so easy to calculate by mental arithmetic:
NYSE:F*97-?
NYSE:F*97-(10.45*97)

For short positions, the formula is exactly the same, but the profit will display on the y-axis as a negative number:
NYSE:F*97-(13.50*97)

For long-term trend-following positions that have involved buying and selling, the price per share has to be the breakeven price of the position. This would need to be calculated in a spreadsheet beforehand.
+1 Reply
thank. a lot of work done.
+1 Reply
@RafaelValenzuela, you welcome 😀
Reply
@boji1 , i also found i can simply input MSFT*200 + AAPL*200 + TWTR*200 ..... etc (as if i hold 200 of these stocks in my portfolio) and TV will interpret the symbols properly - and i get my portfolio charted - without the need to worry about or search for which exchange these stocks are listed on..

thanks to your tip here, i can now chart and analyze my total portfolio (i only have 8 positions) and apply my indicators - and see when is the right time to take profit on some of the positions, before a down turn is expected..

that is gold buddy ... big thank you again .. keep it up. :)
+1 Reply
@RedKTrader , much thanks appreciate 🚀🚀🚀
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar About Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Private Messages Chat Sign Out