#### Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.

# Consolidation scan

dear Mark i want to ask a question.
i want to do a scan looking for stocks that in the last 2 years fell by 50% to 99%, and then i want to take those stocks and run a scan looking for a consolidation pattern/range that the stock has traded in for the last 150 to 200 days of 100% (i.e. the stocks have traded WITHIN a 80% to 120% range in the last year.

This is what i came up with, can you help correct it?

//Price drop of 50 to 90% in the past 800 days
and [PctChange (800,close) <= -50]
and [PctChange (800,close) >= -99]

//Consolidation of between 80 and 120% range over the past 150 days
and [today's close < today's SMA(120,close) * 1.99]
and [today's close > today's SMA(120,close) * 0.01]

• mod
A year in trading days is 251, so two years would be 502, not 800 (251 = 52 wks x 5 = 260 - 9 holidays).

You want the max price in the last two years, not the price 2 years ago, so you want to compare to

max(502, close)

to get the highest price no matter when that high price was in that period.

Then you want 50 per cent lower - so multiply times .5 - and 90 per cent lower - so multiply by .1 (1 tenth of the high price is 90 % lower), so:

and [close < max(502, close) * .5]
and [close > max(502, close) * .1]

I'm not sure what you mean by consolidation of 80 to 120 per cent. I think you mean the high price over the past 150 days is not more than 2.2 times the low price, but at least 1.8 times the low price. If that's right, then

and [max(150, close) < min(150, close) * 2.2]
and [max(150, close) > min(150, close) * 1.8]

I haven't tried this, so you will have to test it.

P.S. 150 trading days is 30 weeks - is that what you want?
• My purpose in the first clause is to find stocks that have collapsed. In many cases after stocks collapse they need to bottom and the process can take lets say 4 months to 2 years. So, my purpose then in the second clause is to is basically find stocks which over the last 4 months to 2 years traded in a range of 100% to 200% i.e. \$1 to \$2 or 3\$

IF, i can get this formula right, then i can add on to it a momentum scan to give me a heads up when stocks of that description are turning up. LOOK at stocks like NK, NVAX, EQT, UNFI

They are very interesting....so i am trying to see if i can approximate that pattern of falling, bottoming and then showing upward momentum.

So is this second clause correct:
//Consolidation where stock trades in a 200% range WITHIN the past 150 days
and [today's close < today's SMA(502,close) * 1.99]
and [today's close > today's SMA(502,close) * 0.01]

Also, regarding 1st clause.
In the first clause i found that from a practical point of view your scan and mine seem to find some of the same stocks. Im trying to wrap my head around why and if i have made a mistake.
firstly this statement:
and [PctChange (800,close) <= -50]
and [PctChange (800,close) >= -99]
catches stocks which fell 50 to 90% now as compared to the price 3 years and 2.5 months approximately

and your scan, looking at a diff time period i.e. 2 years
and [close < max(502, close) * .5]
and [close > max(502, close) * .1]

• mod
edited May 2020
1st clause:

There's no reason there couldn't be some overlap. Your scan asks to compare today's price to a price 800 bars ago. Mine asks to compare the highest and lowest price within a specified period. They are both asking for stocks that have fallen significantly within a wide range of time and a wide range of price. Some of those will fit both criteria.

2nd clause:

I don't think difference from the current MA is the right approach. It only looks at today's price vs. today's SMA. That doesn't tell you how far price has wandered from the SMA over the entire period. If you are looking for the size of a range over time (which is what your doing), you want to compare the max over time to the min over time, where the max does not exceed the min by some per cent.

Finally, I don't think you should try to put all your requirements into one scan. Instead, run your "collapse" scan with a back date - e.g. 150 days ago - and put the results in a list. Then run the "consolidation" scan as of today against the list. Otherwise, you have to put the date offsets for the collapse in your scan, which could get messy when you want to change the offsets.
• ✭✭
I don't know if the Scan engine has the same limitations as the charts but you can only show a max 600 period on a chart indicator. If you put 800 in ROC, for example, it displays the 600.

If you put a 800d ma and a 600d ma you'll see the same line.

When looking at such long term periods, it's probably better to use the Weekly or Monthly indicators in the scan. So 800 day would be approximately 160 weeks or 38 months
• thank you both very much. So you are suggesting to look for stocks that have dropped in one scan, stocks that are in a range consolidating in another scan, and then finally with whats left of the list look for those exhibiting momentum.
And, thanks Imkwin for the info about 600 period. I was not aware. I will try the scans with weekly and see what happens. Never tried that.
• ✭✭
edited May 2020
@shammyx1

//Price drop of 50 to 90% in the past 800 days
and [PctChange (800,close) <= -50]
and [PctChange (800,close) >= -99]

becomes

//Price drop of 50 to 90% in the past 160 weeks or approximately 800 days
and [weekly PctChange (160,weekly close) <= -50]
and [weekly PctChange (160,weekly close) >= -99]
• mod
I think you have to specify weekly close.

and [weekly PctChange (160, weekly close) <= -50]