Premarket up or down x percent from previous day close


Category:
0
0

Pete,

I’ve been searching through your scan tab and can’t seem to find what i’m looking for…I’m trying to scan for stock up or down 4% from the previous day close….I’ll be doing this scan in pre market…

 

Thanks

Marked as spam
Posted by (Questions: 49, Answers: 42)
Asked on September 21, 2019 9:54 am
207 views
0
The title to your question is far too vague "Previous day close scan". It needs to include the fact this scan will run in premarket hours and that you want to pick up stocks that are x% above or below previous day's close. I will update the title accordingly.
( at September 21, 2019 10:48 am)
0
Private answer

There are a very large number of requests for this in the forum. This is most often referred to as a premarket gap scanner. The one that does 95% of the grunt work for your request is here:

https://www.hahn-tech.com/ans/after-hours-gap-scanner/

I will include the code from that post:

input marketClose = 1600;
def closeCounter = SecondsTillTime(marketClose);
def regSessEnd = closeCounter[-1] == 0;
rec priorDayClose = if regSessEnd then close else priorDayClose[1];
plot data = priorDayClose;

...and then add one line to complete your premarket gap scanner.

First we need to change that plot statement to def:

def data = priorDayClose;

Then add the scan plot to find stocks currently trading 4% or more above or below previous day close.

plot scan = close >= data * 1.04 or close <= data * 0.96;

Complete.

Now I will put that all together into a single piece of code and include a user input to adjust the percent value so that other visitors to this post can apply it to their own needs.

input marketClose = 1600;
input percentChange = 4.0;
def closeCounter = SecondsTillTime(marketClose);
def regSessEnd = closeCounter[-1] == 0;
rec priorDayClose = if regSessEnd then close else priorDayClose[1];
def data = priorDayClose;
plot scan = close >= data * (1 + (percentChange * 0.01)) or close <= data * (1 - (percentChange * 0.01));

You must set the Study Filter for this scan to an intraday aggregation period and check the box to include extended hours. There will be some stocks that do not trade in after hours session and this scan will not pick up. This is because the time used to determine the previous day close is the first bar of the extended session.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on September 21, 2019 11:10 am