Hi I have just started using Interactive Broker's API trading through excel. I am a total newb at it and was wondering if the following is possible. I am doing a pairs trade, when stock X and Y are trading at a premium of greater then 25% I would like to buy x and short Y. WHen it is trading below 12 I'd like to unwind the trade. Anyone know an easy way to do this in Excel? I thought about using if/then statements but not quite sure how. Any help greatly appreciated.