Need Help In Coding This Strategy

How to code a script that finds Cup and Handle formation in stocks? Is it even possible to determine the ‘U’ shape of the cup and then the handle part? I want the script to notify me of breakouts or maybe when the stock is in the handle part.

Cup and handle is the chart pattern and it can not be coded with tradescript you can use pattern recognition in Zerodha pi,