This is my "Exotic SMA Explorations Treasure Trove" intended for educational purposes, yet these functions will also have utility in special applications with other algorithms. Firstly, the Pine built-in sma() is exceedingly more efficient computationally on TV servers than these functions will be. I just wanted to make that very crystal clear. My notes elaborate...
Finite Impulse Response (FIR) Filter indicator script.
This indicator was originally developed by John F. Ehlers (Stocks & Commodities V. 20:7 (26-31): Zero-Lag Data Smoothers).
NOTE: Ehlers' favorite FIR filter had 1, 2, 3, 3, 2, 1, 0 coefficients.