Close above high of low day


Category:
0
0

Hi Pete. I am attempting to scan for stocks are making a bounce. I came across the shared think script below which adds a column in the watchlist that shows if a stock closes above the high of a recent low day. Can you help me with creating a scan which will allow me to search for stocks that have just closed above the high of a recent low day.  I would also like the ability to scan for stocks that recently closed below the low of a recent high day.  Here is the script:

#CAHOLD /CBHOLD Column
#close above high of low day, attempts to identify last above the high of low days (green)to include harami patterns, close below low of high day attempts to identify the last below the low of high days(red) to include harami patterns

plot last=close;
def cahold = (close> high[1] and low[1]< low[2])or(close> high[1] and low[1]> low[2]and high[1]<high[2])or(close> high[2]and close[1]<high[2]);
def cblohd= (close< low[1] and high[1]> high[2])or(close< low[1] and high[1]< high[2]and low[1]>low[2])or (close<low[2]and close[1]>low[2]);
addLabel(yes,if cahold then “CA”  else if cblohd then “CB” else “-“);
assignbackgroundcolor(if cahold then color.dark_green else if cblohd then color.dark_red else color.white);
#end

Marked as spam
Posted by (Questions: 19, Answers: 18)
Asked on February 18, 2020 4:24 pm
2187 views
0
Private answer

To convert this a scan you need to remove the last two lines of code. Then we take the two variables used to generate the label text and use them for your scan signals:

plot scan = cahold;

or

plot scan = cblohd;

Oh, one last thing. You need to completely delete the following line from the code. It does absolutely nothing and if you leave it in the scan engine will complain that only one plot statement is permitted.

plot last=close;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on February 18, 2020 5:32 pm
0
Thank you Pete!
( at February 18, 2020 10:29 pm)