Custom Filter

Hello everyone. 
I need a custom filter that filters the products by whether they are IN STOCK or OUT OF STOCK, and it has to be a single value selection filter. I have been trying with the attributes but no luck. Any ideas? 
Thanks a bunch