Banknifty straddle

hii how can i create a conditions for following

  1. i want to enter in to straddle when the difference between LTP of CE & PE At The Money leg is less than 10

  2. if the diffrence between both the leg more than 50% (example CE=100, PE=50) PE should exit and next strike PE shold enter.

any one please help me…
thank you…