Comparative Relative Strength

208 7 37
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.
Remove from Favorite Scripts Add to Favorite Scripts
study("Comparative Relative Strength")
a = input("GOOG", type=symbol)
b = input("AAPL", type=symbol)
as = security(a, period, close)
bs = security(b, period, close)
plot(as/bs, title="CRS")
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.

Hi! Thanks for feedback, here a modified version of CRS
festus vitvlkv
@vitvlkv, pls how do I include this modified version into my chart?
thanks for your efforts.
@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
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 vitvlkv
Absolutely perfect, thank you very much!
Really appreciated! good trading...
Republished this code here
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out