Refactoring T_TRADE statement generation 2

Still refactoring, the code can be made much cleaner so it seems. But I'm not here yet.