Tarea técnica
Identify trends and put hedging positions to recovery the loss, then exit with profit using trailing. It first identify the situation, establish a recovery zone. There are some positions which are at loss, against trends. This is actually is an EA, but I like you write an Indi to do this job, as it is easy for you and does not need to open another chart in my VPS, there is another chart running my EA.
Once the condition met, work out total distance and lots of against trends, build up a few grids with pending order with the direction of trends. these new orders' magic number differ to mine. Exit, once total profit break even, trailing, like +$20, put stop loss to $10, etc. If the total profit(considering commision) still negative, but your orders is positive, let it run until exit with minor profit, like 1 pips. This time recovery zone still exit, but the grid pending orders still there waiting for the price rebounce exit recovery zone again. If price back to recovery zone, let my EA do its job. It will close all positions, not sure it will delete pending orders or not. This indi should check if no open positions, not allow pending orders exist.
No idea? I have draw a picture. Contact me, I will post it to you to make my idea more specific.
My idea maybe not the best, you can use your own strategy to make it. Simple words, stuck in new zone, let it go. back to Recovery zone, my EA take it over. repeat, unless trailing exit totally. Recover successfullly.