Dorsey Relative Strength

A custom indicator created by TrendSpider Team on TrendSpider. You can import this custom indicator into your TrendSpider account. Don't have TrendSpider? Create an account first, then import the custom indicator.

Chart featuring the Dorsey Relative Strength indicator

Compares a security's price to the S&P 500, showing if it's outperforming or underperforming the market.

Source code

This indicator had been implemented by TrendSpider Team in JavaScript on TrendSpider. Check out the developer documentation to learn more about JS on TrendSpider.

describe_indicator('Dorsey Relative Strength', 'lower', { decimals: 3, shortName: 'RSD'});

const indexSymbol = input.symbol('Index');

// Convert current resolution to a higher one that contains at least double the amount of candles
const higherResolution = { 1: '2', 2: '4', 3: '6', 4: '10', 5: '10', 6: '12', 10: '30', 12: '30',	15: '30', 30: '60', 45: '90', 60: '120', 65: '240', 90: '240', 120: '240', 240: '1440', 1440: 'D',	D: 'W', W: 'M', M: 'Q', Q: 'Y', Y: 'Y' }[constants.resolution];

const indexData = await request.history(indexSymbol, higherResolution, {	ext_session: constants.session.lengthMinutes == constants.ext_session.lengthMinutes});

const indexClose = land_points_onto_series(indexData.time, indexData.close, time, 'ge');

const rsd = mult(div(close, interpolate_sparse_series(indexClose, 'constant')), 100);

paint(rsd, { name: 'Line', color: 'grey', thickness: 5 });