Exclude stocks gapping plus or minus 3 percent


Category:
0
0

Hello Hahn, I was working in condition wizard and wanted to know how can we filter out stocks that have a mark % change (or even percent change) between -3% to 3% from showing up on scan results. This scan is intended to run between 8am -9:30am and continue throughout the days open.

 

Best

 

Best

Marked as spam
Posted by (Questions: 22, Answers: 63)
Asked on September 23, 2018 7:03 am
139 views
0
Private answer

This should do it.

plot scan = close > close[1] * 1.03 or close < close[1] * 0.97;

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on September 23, 2018 11:25 am
0

Thank you, and if I wanted to widen this range to exclude anything in the range of -10% to +10%. How will I go about doing that?

Will this criteria factor in premarket movements at the scan is most important before 9:30am est

( at September 23, 2018 12:15 pm)
0

Odd that you would ask that. Really has nothing to do with the code. Don’t you see how the math is computed? Times 1.03 and time 0.97? That is plus 3% and minus 3%. Change those values to whatever percent you want.

This code would be set to daily time frame. So it does not even factor in any premarket data. All it does is compare today’s current close to yesterday’s close.

( at September 23, 2018 12:47 pm)
0
Private answer

I see that the original request was for a scan that would function in premarket as well as regular session hours. I looked at the built-in scan filters and found one named “AfterHours_Percent_Change”. It’s listed as a Study Filter, under the section named “Price Performance”.

This built-in study does almost everything we need. However it does not function during regular session hours and only covers one direction of percent change. It’s either greater than x percent or less than x percent. There is no way to do both directions.

So I copied the code from that built-in Study Filter and modified. I have not tested this so I am not sure if it works as expected. So test it out and let us know. It is intended to run on an intraday time frame and be sure to check the box for extended hours.

input closing_time = 1559;
input open_time = 0930;
input price = close;
input percent_change = 3.00;
def time_until_close = SecondsTillTime(closing_time);
def time_until_open = SecondsTillTime(open_time);
def closing_bell = time_until_close == 0;
rec closing_price = CompoundValue(1, if closing_bell then price else closing_price[1], price);
def after_closing_bell = time_until_close <= 0; def before_opening_bell = time_until_open >= 0 ;
def afterhours_percent_change = 100 * (price / closing_price - 1);
def meet_scan_criteriaGT = afterhours_percent_change >= percent_change;;
def meet_scan_criteriaLT = afterhours_percent_change <= percent_change;;
plot scan = meet_scan_criteriaGT or meet_scan_criteriaLT;

 

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on September 25, 2018 9:15 am