Are you familiar with the basket order tool? You would need two baskets, one for long entries, one for short entries.
You can also execute from the commandline too. See the help file for .executebasket command.
As far as doing this from EL logic, I think you can only run a script on one...