TradingView
vitvlkv
Aug 6, 2014 1:24 PM

Comparative Relative Strength 

Apple Inc.NASDAQ

Description

The Comparative Relative Strength indicator is calculated by dividing one security's price by a second security's price (the "base" security). The result of this division is the ratio, or relationship, between the two securities.
Comments
mc16
Thanks for making this script, this indicator was heavily missing on TradingView.
The real problem with this code is that required to manually enter each ticker every time!
This is really time consuming and isn't efficient at all.
I don't have any clue how to code but parameter A (GOOG) should be automatically recognized and insert on the current chart we are looking at, while parameter B should be fixed (ex. SPY)
Will be great to have the possibility to add a moving average on it as well.
After using this script for the past few days I found out that results are slightly different from the price ratio of other charting software, how this could be?

Like I said, I can't code but I really need this indicator to work properly on TradingView and If there is something that I can do, well just contact me.

Thanks
mc16
vitvlkv
Hi! Thanks for feedback, here a modified version tradingview.com/v/dZvHbSqD/ of CRS
festus
@vitvlkv, pls how do I include this modified version into my chart?
thanks for your efforts.
vitvlkv
@festus, Open the url (where the modified version is) and toggle "Add to Favorite Scripts" star button. Then this indicator would be in "Indicators" dialog, in the Favorites tab
vitvlkv
Here is a version with MA smoothing

study("Comparative Relative Strength", shorttitle="CRS")
a = tickerid
b = input("SPX500", type=symbol)
as = security(a, period, close)
bs = security(b, period, close)
plot(as/bs, title="CRS", color=gray)
len = input(10)
plot(sma(as/bs, len), color=navy)
mc16
Absolutely perfect, thank you very much!
Really appreciated! good trading...
vitvlkv
Republished this code tradingview.com/v/yrDnXj4F/ here
More