Coding for Option buy/sell

Hi, I need code to buy and sell option by comparing price of two options.

Example :

I am holding ICICIBANK16FEB185PE.

It has to compare the price of ICICIBANK16FEB185PE with ICICIBANK16FEB190PE.

If the difference is less than 50 ps then it has to sell the ICICIBANK16FEB185PE and buy ICICIBANK16FEB190PE.

Please let me know if it is possible to create code for this.

It is not possible to compare with two different script and generate an alert with tradescript