Auto selection of strikprice based on market direction

How to automate strike selection based on market direction along with relevant option to buy in order to move with the direction of the trend?