Am working on a logarithm that regulates take profit zones

 

The common challenge of most bots emerges at the support and resistance levels, where buy, limit & stop orders or vice versa continue to open as per the trend just until confirmation of the new turn around trend from support or resistance kicks in. The problem with this is that in some bots make a constant loss of trades that will occur every approximate number of trades usually opened at the turn around levels. Example: In one of my EA's 'BETA SIM EA, when set stops loss range at 60 pips, will have good profit returns except for a loss of $6,$60, etc depending on lot size & trading asset. The basic idea is to develop a function that looks like this: If TP >last 3 Day candle highs/3; check range price of the last 3 days & store in value x. x-TP = New TP. If New TP<BUY PRICE (For buy orders or less for sell orders), perfom a loop a loop for original TP-- =< D candle average of (3+2+1/3) = y .   adjust original take profit to y. So, what would be your thoughts about this logic?