Can we scan for price of 2 years ago?

I'm looking for stocks to test against, and I'd like to be able to run a scan for stocks with price between $15 and $300 two years ago. I have tried:

close[506] >= 15 and close[506] <= 300


close from 506 bars ago is greater than or equal to 15 and close from 506 bars ago is less than or equal to 300

with aggregation set to daily, but in both cases it says there are no matching stocks. Is there a way to do this?


Well-known member
It stopped scanning at 24 months back, so you might have to settle for 23 months back. Be sure to set to the MONTHLY aggregation

def price_2_years_ago = (close(period = AggregationPeriod.MONTH)[23]);
plot scan = price_2_years_ago > 15 and price_2_years_ago < 300;
Thanks, @XeoNoX. Carrying on the testing, I've determined that you can go back 503 days, but no more; I was reaching just 3 days beyond the limit.

Also, if a criterion refers to bars prior to that (such as checking a 50 day MA), you need to adjust even more, so you can scan for a 50 day SMA no more than 453 days back.

Restrictive, but it is what it is - I'll tweak my criteria accordingly.

Similar threads