Scan for new relative strength high


Category:
0
0

Hi Pete,

I am trying to scan for relative strength making a new 250 day high. I tried adding the following to the existing
relative stength scan:

plot BuyDot = if SRatio == Highest(SRatio,250) then high else Double.NaN;

This does not provide correct results.  Wondering what tweaks are needed to make it work.

 

Thx

Laurie

Marked as spam
Posted by (Questions: 1, Answers: 0)
Asked on October 21, 2019 10:40 pm
105 views
0
Private answer

The code you provided in your request is not complete. I cannot explain where you went wrong to help you learn. I can only provide a solution of my own based on your stated goal.

You stated that you added that line of code "to the existing relative strength scan". However there is no existing relative strength scan in Thinkorswim. So we have created an island here, with no way to get folks on and off the island.

Here I have copied most of the code from the RelativeStrength chart study included with Thinkorswim. I have added two lines to complete the scan, which identifies stocks making a new 250 day high in RelativeStrength as compared to the ticker symbol "SPX".

input correlationWithSecurity = "SPX";
def close2 = close(correlationWithSecurity);
def rs = if close2 == 0 then 0 else close/close2;
def sr = CompoundValue("historical data" = RS, "visible data" = if isNaN(sr[1]) then RS else sr[1]);
def srHighest = Highest(sr, 250);
plot scan = sr == srHighest;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on October 22, 2019 10:24 am