Algo for future spread

Is it feasible to place automated market orders for future spread in two different scripts? For example, I want to buy bank nifty and sell nifty simultaneously if bank nifty is x% down compare to nifty, where x=(nifty percentage gain-bank nifty percentage gain).

Automated orders are not allowed by exchange. One can possibly code and generate alerts but orders has to be manually placed.