Traditional RS compares the percentage change of one symbol over a given time frame and subtracts the percentage change of the S&P 500 over the same period.
This is handy, but it can produce false signals at times of . For example, when the broader market is crashing, certain sectors may “outperform” simply by falling less than the S&P 500 .
Smart addresses this shortcoming by requiring that the symbol’s absolute AND relative returns both be positive. Otherwise a zero is returned.
This was useful last week on the Dow Jones Transportation Average . Using simple , it had its best one-week performance against the S&P 500 since October 2008. This was obviously a false signal because October 2008 was a time that everything else was crashing.
Smart showed that, excluding periods of overall decline, DJT had its best week since January 2008.
Note: This chart uses a 1-period interval, while the code defaults to 21 periods.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.