There were some errors in the previous Indicator

.
using pos-1 in the EMA calculation was wrong because pos -1 is a bar in the future, it works only if there was future bars (while drawing the indicator from the first bar, the second bar is -1 of the first bar, and the third bar is -1 of the second bar etc. but the -1 of the current bar is not exist yet).
Anyway, this is the new version of the indicator.
I hope to see your comment! Is it worth to enhance or to forget

!