AFIRMA - MetaTrader 5 Script | Trading Script Download - MT4/MT5 Resources - MetaTrader 5 Resources

Digital filter-based AFIRMA (Autoregressive Finite Impulse Response MA) displays price movements accurately, but with a time lag.
Moving averages are based on smooth function fits (polynomials or sine/cosine in Fourier transform) without lag, but generally show price movements not very well.
The proposed moving average smoothes price movements using a numeric filter on all candlesticks, except the latest, with an amount equal to the filter time lag. These candlesticks are smoothed by cubic spline fitting using the least squares method. The condition for the continuity of the combined moving average and its first derivative is set at the intersection of two moving averages. Therefore, we have a smooth moving average that tracks price accurately with no time lag.
Input parameters:
The first part of the MA built using digital filters is shown by the blue-violet curve. The second part of the MA constructed by cubic spline fitting is shown by the red curve.

Attachment download
📎 afirma.mq5 (8.92 KB)
Source: MQL5 #603
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •