Find stocks which close specific percent below the high


Category:
0
1

Hello Hahn,

Can you please creation a scan condition that looks for stocks whose close price on the day is ateast 50% away from its high price on the day? Visually this would show a candle with a long wick.

I tried to do this in condition wizard but it did not work.

 

Best

Marked as spam
Posted by (Questions: 22, Answers: 63)
Asked on August 16, 2018 2:49 pm
120 views
0
Private answer

Along with this solution I will explain the request clearly states “50% away from it’s high”. There is only one way to interpret this. And that is to take the high of the day, multiply it by 0.5. So that a high of 100 would result in a close of 50. That is the close, 50% away (down from) the high.

Since this is never going to appear on any chart I am very certain that something else entirely was intended. However I am not going to act on that until further details are provided. Here is the code based on a strict interpretation of the request.

input percent = 50.0;
def percentCloseFromHigh = 100 * (close / high - 1);
plot scan = percentCloseFromHigh >= percent;

I suspect the true intent of this request is that the close should be half way between the range of the high and low of the bar. In which case the close would be in the middle of it’s daily range. We’ll wait to see what JB has to say.

Edit

So I was correct. JB has just confirmed what I suspected was the true intention. Sorry that this post is going to be very confusing for the rest of our viewers.

Here is the solution to the close being in the lower half of the daily range (daily high to daily low).

input percent = 50.0;
def percentCloseWithinRange = (close - low) / (high - low);
plot scan = percentCloseWithinRange * 100 <= percent;

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on August 17, 2018 8:22 am
0

You hit the nail on the head, my true intent of this request is the close should be half way between the range of the high and low of the daily bar.

You are correct which case the close would be in the middle of its daily range.

Visually this would show a green candle with a long upwards wick.

( at August 17, 2018 10:01 am)
0

I have updated my answer to include the code for this.

( at August 17, 2018 11:16 am)
0

So from testing the code, it seems that the scanner picks up red candles also, I wanted to know if we could tighten the code up to only show the current dailey GREEN candle only whose close if ways off from its high on the daily chart. Thank you

( at August 31, 2018 12:15 pm)
0

This does not need to be incorporated into the code. It can be added as a separate Study Filter, set to the same time frame. You can build this with the condition wizard. Close is greater than Open. The end result should be:

close > open

( at August 31, 2018 1:38 pm)
0

thank you

( at September 1, 2018 6:16 pm)
0

Hello Hahn, do you know why the code provided for this solution is not picking up the stock NBEV right now, it seems to have closed weak off its high for the day?

( at September 18, 2018 3:42 pm)
0

As of the close on 9/18/18, this did not close in the bottom half of the range. It closed in the upper 25% of the range. Are you working with a daily time frame?

( at September 18, 2018 3:51 pm)
0

Yes, i see, I need to look at the entire range

( at September 18, 2018 4:35 pm)
0

Another question, why didnt this stock pick up CSBR as of today 9/18/18: Did the stock close 50% from the high ?

( at September 18, 2018 9:53 pm)
0

No, it just missed. CSBR would have had to close below 12.25 and it closed at 12.30.

( at September 19, 2018 7:39 am)