How to execute code on both sides of trade?


Here is the query:
Suppose I want to create Supertrend Algo for NIFTY F&O for both sides LONG as well as SHORT, then how to do that ?
If I create two different Algos with One as LONG and other as SHORT, how it will work ?
I mean when LONG Trade executed, and after sometime if SHORT Conditions also get matched and if I SHORT that trade as well, will it be squared off with my PREVIOUS NIFTY LONG ? Or it will just throw the DIFFERENT ORDER ?

Please explain anyone about this TWO SIDE ALOGS ,