Nicolas

Relative Strength Rank Indicator

Category: Indicators By: Nicolas Created: July 8, 2019, 9:47 AM
July 8, 2019, 9:47 AM
Indicators
12 Comments
Relative Strength Rank Indicator

This indicator is a ranking tool used to compare a group of stocks, ETFs or futures contracts to determine which specific instrument is performing best. The indicator creates a score based upon the symbols historical price movement. You can then compare this score to the other RS Rank scores of other stocks or ETFs in your basket of trading instruments. Thus, you can simply pick the instrument with the highest RS Rank score when creating a momentum based trading system.

The RS Rank is computed by taking the average of a long-term price change with a short term price change. This average is then divided by the 10-day Average True Range. This will produce a ranking score which can be compared to other instruments.

//PRC_Relative Strength Rank | indicator
//08.07.2019
//Nicolas @ www.prorealcode.com
//Sharing ProRealTime knowledge

// --- settings 
RsrShortPeriod = 20
RsrLongPeriod  = 140
RsrMaMode      = 0 //MA type 
AtrPeriod      = 10
// --- end of settings 

RsrPrice       = customclose

price = average[1](RsrPrice)
mas   = average[RsrShortPeriod,RsrMaMode](RsrPrice)
mal   = average[RsrLongPeriod,RsrMaMode](RsrPrice)
atr   = averagetruerange[AtrPeriod]
if (atr<>0) then 
 rsr = (price-mas+price-mal)/(2.0*atr)
else  
 rsr = 0
endif

slope = slope[1]
if (rsr>rsr[1]) then 
 slope =  1
endif
if (rsr<rsr[1]) then 
 slope = -1
endif

rsrhuu=0
if (rsr>0) then 
 if slope=1 then
  rsrHuu = rsr
 else  
  drawbarchart(0,rsr,0,0) coloured(0,191,255)
 endif
endif

rsrhdd=0
if (rsr<0) then
 if (slope=-1) then
  rsrHdd = rsr
 else  
  drawbarchart(0,0,rsr,0) coloured(199,21,133)
 endif
endif

return rsrhuu coloured(0,191,255) style(histogram), rsrhdd coloured(199,21,133) style(histogram), rsr coloured(150,150,150) style(line,4)

 

Download
Filename: PRC_Relative-Strength-Rank.itf
Downloads: 296
Nicolas
Nicolas Legend
I created ProRealCode because I believe in the power of shared knowledge. I spend my time coding new tools and helping members solve complex problems. If you are stuck on a code or need a fresh perspective on a strategy, I am always willing to help. Welcome to the community!
Author’s Profile

Comments

szohori
6 years ago
#

is there a rs indictor that compare the stock to the spy?

Sudu
6 years ago
#

HI Nicolas, I know I'm bit late to use this somehow feel to give it a go. I cut and paste then I've got an error in line 38 "The keyword drawbarchart is only used for indicator programming (Probuilder) and also line 40 "endif". any help please

Nicolas
6 years ago
#

I think that you are trying to put an indicator code into a strategy or a screener code. Open the indicator creation code editor and everything will run fine.

gildaslm
7 years ago
#

Hi Nicolas, could you help me to set up the screener for this. Thank you !!

Nicolas
6 years ago
#

Sure, please open a new topic in the screener forum and respect the posting rules.

FabiusMor
7 years ago
#

Hi Nicolas, as you suggested I made a screener out of your indicator and the results are really interesting. Couple of questions: -why you divided by 2*atr? -in your opinion could be interesting to add two more timeframes in the calculation? Like 3, 6,9 and 12 months. Thank you and have a nice day!

Weldzar
5 years ago
#

Could you share the screener you have created?

FabiusMor
7 years ago
#

Thank you Nicolas. As I said in the other post I don’t know how to make a screener out of it yet. I’ll take a look to the documentation. Thanks a lot!

FabiusMor
7 years ago
#

Good afternoon Nicolas, in your opinion, this indicator is somehow similar to the one described in this (http://www.marketgauge.com/LeadershipReport.pdf) document in the first half of page 7? Thank you and have a nice day. F

Nicolas
7 years ago
#

Yes this is the same as described in this document.

cavineet
7 years ago
#

Hi Nicolas, I have been using pr real time extensively but just end of the day. I would appreciate some advice on automated system where system it buys on cross over of 8 and 20 and sell also accordingly. How to get started with that automated system? Can you suggested the possible steps? I have interactive broker account Thanks Vineet

Nicolas
7 years ago
#

Please ask questions on forums. Not the place here and not related to that post:)

ProRealCode ProRealCode
Loading...