This type of moving average was originally developed by Bruno Pio in 2010. I just ported the original code from MetaTrader 5.