You could just have a gap scanner on one list and the spy on a different list and pretty easily check what is gapping 3x more then the SPY. I do that every day, i check to see what the spy and qqqs are doing overnight and check my scanner to see what is moving up or down relative to that. the SPY rarly moves that much overnight so its not usually that useful in that way you are describing because since the SPY is only moving .25% on average its basically already at baseline, so seeing a stock that is up 3.25% its just not that much more interesting in this context then just 3%. in that context.
You are doing to be seeing ALOT of stocks that are moving 3x what the spy does overnight, that doesn't mean they are in play. A stock gapping .75% doesn't even hit my radar. 1% is minimum and usually i dont even glance at those. 3% gap in either direction is interesting, after that i want to see elevated premarket volume
Off topic but if you want to find stocks in play the simplest way is going to be to see
1. stocks doing elevated premarket volume (can see this by comparing the average daily volume to the shares traded in the AM before open. expressed in a %, if todays stock is doing 10% of its ADV in the premarket, its on my watchlist. Period. 30% or more, its top of the list.
2. stocks that are gapping 3% or more up or down
3. after market open i use RVOL, Anything or 2 is intersting, anything over 3 is in play (you can see RVOL on finviz.com for free, im working on a thinkscript version Rn
I digress
i cant code that well in thinkscript or would do it for you but goodluck, just wanted to comment my two scent. would be easy just to check the spy and check your scanner.
Cheers