Scan for Relative strength


Category:
0
0

Hi Pete, thanks for all your videos and your scripts.

 

I want to check for relative strength of a stock with SPY on daily basis.

 

I was the stock to out perform the index  (for today)

 

is this code correct as i get some results which are not  outperforming and some are outperforming

 

input CorrelationWithSecurity = “SPY”;

def close2 = close(CorrelationWithSecurity);

def RS = if close2 == 0 then 0 else close/close2;
#RS.setDefaultColor(GetColor(6));

#def startDate = DaysFromDate(referenceDate) == 0;

#addchartbubble(startDate, RS, “Start”, color.RED);

def sr = CompoundValue(“historical data” = RS, “visible data” = if isNaN(sr[1]) then RS else RS[1]);
def SRatio = sr;

#plot Scan = RS[1] < SRatio[1] and RS >SRatio;

plot Scan = lowest(RS -SRatio,1) >0;

 

Thaks,

Raviraj

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on January 12, 2022 1:41 pm
334 views
0
Private answer

We've already published a video on this topic:

https://www.hahn-tech.com/thinkorswim-scan-relative-strength/

And once you view the video you will understand why your attempt to solve this is not going to work. Along with the video we provide the code to perform Relative Strength scans.

I suppose if you had used the search box available on nearly every page of this website you would have found that video and not needed to post this question at all.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 12, 2022 1:52 pm