# Stocks closing above or below X% of previous bar

Category:
0
0

Hey Pete, I’m looking for a scan that can search for a stock’s close within 20% of the previous candle’s high. We can use the daily candle as a timeframe. It’d be searching for stocks closing 20% above or 20% below the previous candle’s high. Thank you for your time sir.

Marked as spam
Posted by (Questions: 11, Answers: 19)
Asked on August 13, 2020 5:08 pm
39 views
 ▲ 0 ▼ ✔ Private answer Perhaps you can try something like this to get the close above prior day's high by 20%: `input percent = 1.2;` `input length = 1;` `def closeAbovePriorHigh = close > (high[length] * percent);` `plot scan = closeAbovePriorHigh;` Results as of 8/13 for stocks above \$10 Symbol %Change GRWG 42.69% RVLV 22.05% AZPN 29.08% NRIX 36.97% FTLF 21.95% SNCPF 50.68% GRGSF 20.88% SBBTF 62.70% TGNOF 20.11% Peter may have a better solution. Marked as spam Posted by lucius fox (Questions: 5, Answers: 10) Answered on August 13, 2020 7:35 pm Hey thanks man but I’m looking for close within 20%. So the close would need to be no greater than 20% of previous high and no less then 20% of the previous high. (Steven Bernal at August 14, 2020 10:49 am) I drew an example on ms paint of what I'm trying to say: https://m.imgur.com/6VMy00X Price = previous day's high and 20% max = current day's close (Steven Bernal at August 14, 2020 11:07 am) Thanks for your participation lucius. Much appreciated. (Pete Hahn at August 14, 2020 1:20 pm) ▲ 0 ▼ ✔ Private answer I think this will do the trick. I haven't tested it so let us know if it doesn't do exactly what you requested. I included user inputs so you can adjust the percent threshold as well as the target price without modifying the code. ```input percentThreshold = 20.0; input targetPrice = high; def highLimit = targetPrice[1] * (1 + percentThreshold * 0.01); def lowLimit = targetPrice[1] * (1 - percentThreshold * 0.01); plot scan = close < highLimit and close > lowLimit;``` Marked as spam Posted by Pete Hahn (Questions: 37, Answers: 3222) Answered on August 14, 2020 1:20 pm