Trailing stop that gets smaller as profit increases

 

I have just written a trailing stop function that starts at a hypothetical 20 pips and progressively decreases down to another hypothetical 5 pips as a trade becomes more and more profitable.


It seems to be working but it's really messy and I would love some feedback.


Thanks

Reason: