help for mtf heikin ashi

 
Hi, I state that I am new in mt4 and trading in general.
I found on internet the indicator attached that I used to create simple signals. But then I realized that in live the color change is not always simultaneous with the indicator Heikin ashi, but often takes place only at the opening of the new candle. and in addition with the change tf it repaints past data.
I would like to know how I can solve these two problems, namely:
- Simultaneous change color with hh and not at the next bar
- no repainting data passed of superior time frame.
Or alternatively if somebody already have what I seek.
Sorry for my English and thanks in advance.
Files: