Relative Strength Auto Comparison

Relative Strength Comparison with automatic selection of relevant index

Added support for most european and north american exchanges.

Release Notes: Added SPX as a fallback index if no match found in table
Release Notes: - Updated table with Exchange / Comparative index to include forex exchanges Oanda, Saxo, Fxcm,, and ice data serv. Used the dollar basket as comparative index in these cases
- tweaked input settings, everything enabled by default
Release Notes: n/a
Release Notes: // Auto Comparative Relative Strength //

*. Compares strength of a symbol (usually an Asset/equity/stock) to the strength of a comparative symbol (usually an index)
*. autoselect of relevant comparative index/symbol
- Primarly for stocks. Uses a Global index to compare other indexes or cfd's. and dollar basket if symbol is a forex instrument.
*. Override function to use as normal RS line with specified index/symbol
*. Override symbol is used as a fallback when no match is found in the autoselect table
*. Zero Cross oscillator, with a moving average cross
*. Debug panel, lists the syminfo data used to select indices. If' anyone discovers bugs or unexpected behavior, a screenshot of the debugpanel should help track down the problem.

- Bugfix with _DLY suffix in the exchange info if you recieve only free data / not paid for realtime from exchange
- Workaround for the Euronext exchanges, uses timezone to select index, (so euronext paris, uses the cac40)
- simple moving average for the change calculation, experimented with different weights and moving averages for the change calculation. Sma works good and reliably.
- overridesymbol doubles as fallback index
- Added India's national stock exchange matchet to the nifty.

Known issues
Need to fill the table of exchanges and indexes. Only North American, European and India Stock Exchanges added so far.
requires some research, or even better, local knowledge to match a prefered index to a stock exchange
suggestions are welcome: The debug panel should give information on the Exchange, Symbol and index used for comparison
Release Notes: Workaround/bugfix: syminfo.prefix only 8characters max? truncation of exchange names.
Skript med en öppen källkod

I sann TradingView-anda har författaren till detta skript publicerat det som öppen källkod, så att handlare kan förstå och verifiera det. Skål för författaren! Du kan använda den gratis men återanvändning av den här koden i en publikation regleras av våra Ordningsregler. Du kan göra den till favorit för att använda den i ett diagram.

Vill du använda det här skriptet i ett diagram?


Hi sir, it's a great indicator. Thank you.
+3 Svara
I would like to know if there is any screener based on exchanges if it can filter the stocks which are under overbought greater than 0 and oversold less than 0.
+2 Svara
sjakk justsri
@justsri, afaik there is none on tradingview. First that comes to mind is (the IBD rating there, is probably partially a relative strength comparison between assets to asset or assets to index.)
Hi what is the 50 and 10 range? 10 is SMA and 50 SMA? can I change the range for day trade and also change to EMA?
sjakk thvo1
@thvo1, Hi, why not just try changing values and verify what happens and how it reponds?

tldr; A more responsive smoothing isn't always a good thing.
It's wise to remember, a filter is only the removal of data, for the purpose of removing noise, it is NOT additional data in it self.

50 is the sma of the self comparative (close / sma(close, 50)) Changing the averaging method here is not included in the script as I believe it doesn't bring anything to the table. The same sma function and sma length is used as both numerator and denominator. You can shortening the period to less than 50 to make this more responsive and noisy. (the purpose of using sma here is to just smooth out the inherent problem with a simple offset RS "close / close", a sharp response is actually undesirable)

The 10 is an ema(RSline, 10) the signal line plotted on the chart along the RS line. This could use any smoothing filter really, but to keep code easy and simple, I didn't feel like adding options.
As for daytrading, this is written with the daily and weekly chart in mind. and since this is relative to an index, it's more of an helping hand in understanding who are the leaders and laggards in the market.