Thank you very much for all the time you took to help me - it helped me, even though a solution was not needed. Just now, after I kept trying for hours, I realized that my original function, that is to say: If Openpositionprofit > Amount Then Begin If Fast Crosses Below Slow Then ExitLong This Bar; If Fast Crosses Above Slow Then ExitShort This Bar; end; It worked very well, but I had thought it didn't work because I was still seeing all those arrows signalling trades in all directions and I said to myself - why isn't my target getting rid of all these signals? The reason is that the signals I was seeing were not exits, but they were entries in the opposite direction. So not only did I have to get rid of "false" exit signals, but also false entry signals. I did that by inserting the same "if statement" in the entry part of the signal. Thanks again for your help.