Thanks my friend. It needs also another small tweaking. I was testing the indicator today, it is working almost perfectly with the exception of oscillation of values during the day. I took some screenshots for you to see. First I was testing in the simulator, but I noticed that it was not working properly, but it is because the indicator does not work in the backtester, not because it does not work, unfortunately can´t test it in backtester. On the simulation the day never resets, the indicator "thinks" it is always the same day. So I left it running on a live chart and I could see it resets properly.
What I noticed during the day is that the ADR and ADM values keep oscillating some pips up and down. I think it is because the code is considering the current bar in the calculation, you must exclude the current bar from the calculation. If ADR and ADM are set to 7 days, for example, then it will consider the last 7 bars, excluding the current one, I think this will fix the value oscillation. Also, I noticed that the percentage in ADM is not only increasing, but also decreasing. This must be corrected because if we are doing a "countdown" of the value, it must go always in one direction. I noticed that one time the ADM was at 63%, then it was at 65%, then 64%. then 63%. It should be always increasing going forward. This behavior I also noticed on the simulator going high speed, I could see the ADM percentage going up and down.