Open interest declining code needed in Pi

I started using Pi and it is awesome. Im trying to code my strategy but I’m not able to find OI related function Tradescript. I want to find whether OI is below 20 period simple moving average (declining OI) . Kindly help.