There is a lot in that to dissect, put your variables into a comment to check if you are getting the values you expect. You should use text (code input) for code., come back if you need more help when you you've tried rhis:
@crazycnw This will only work for for trades placed with the same magic number, on the symbol the ea is added to. Magic 0 is manually opened, you can also set then in the block.
Do you mean trying to do an EA with that indicator? Initially, tes, but until you do not import it to yor fxDReema account you will never know. Do you have it? We can try it.
Sorry, I was wrong. What I wanted to say is the 'close (partially)' block. I 'm still waiting for the admion to fix the problem of this block. Once fixed what you want is really easy to do. I hoep he will do it soon.