The easiest way is to create a TMF that does what you want. You can find examples in the manual at the end of the Trade Functions section. Sorry but I can not direct link it. The manual contains a lot of useful examples while is not the easiest to be navigated and searched.