Whatever problems you have, in the way you explain them to me I can't say much, because there can be many reasons. It's different if you show me a project and tell me "I expect this to work this way, but it does something else".
And you are showing me some project, but what is the problem in it? You say "Also cant get my closing rule for pending orders or trades to work", but what is that rule? Now there are some blocks and they probably do some logic that can be right for someone else, but not for you. Why? What do you expect to happen and doesn't happen?