afirma: autoregressive finite impulse response moving average
Info
The afirma: autoregressive finite impulse response moving average is a Script for MetaTrader 4 that afirma stands for autoregressive finite impulse response moving average. standard moving averages (mas) based on digital filters closely replicate price movement but introduce a lag.
Usage
This tool is typically used for enhancing chart analysis and decision making.
Platform
This Script works exclusively on MetaTrader 4 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL4/Scripts folder via File ? Open Data Folder in MetaTrader 4.
How to Install and Use afirma: autoregressive finite impulse response moving average
1. Installation: Move your script file into the MQL/Scripts directory and restart the platform.
2. Execution: Drag the script onto a chart; it will perform a one-time action, such as closing all open orders or clearing chart objects.
3. Editing: Use MetaEditor (F4) to modify code, click "Compile," and verify no errors appear in the terminal before running.
4. Removing: Scripts stop automatically, but you can remove them manually by right-clicking the chart and choosing "Remove Script."
Frequently Asked Questions
Q: How are scripts different from EAs? A: Scripts execute a single action and then stop; EAs monitor the market and trade continuously.
Q: Can I assign a hotkey to a script? A: Yes, right-click the script in the Navigator, select "Set Hotkey," and define your preferred keyboard shortcut.
Q: Why did my script stop? A: Scripts are designed to stop immediately after finishing their programmed command; this is normal behavior.
What this tool does
afirma stands for autoregressive finite impulse response moving average.
Typical Use Case
This Script excels in automated trading and technical analysis on MetaTrader 4.
Compatible Platform & Setup
This Script works on MetaTrader 4. Place the file in the MQL4/Scripts folder and restart the terminal.
Description & Settings
Related: MetaTrader 4/5 Utility Script: Unknown - another powerful script for MetaTrader 4 traders.
afirma stands for autoregressive finite impulse response moving average.Also recommended: e-v trailing by profit expert advisor - similar script with strong performance on MetaTrader 4.
standard moving averages (mas) based on digital filters closely replicate price movement but introduce a lag. mas based on fitting smooth functions (like polynomials or fourier transforms using sin/cos) lack this lag but often poorly represent price action. the proposed afirma smooths price movement using a digital filter for all but the most recent candles, the number of which equals the filter's lag.
these recent candles are smoothed by fitting a cubic spline using the least squares method. at the junction of the two mas, conditions for continuity of the combined ma and its first derivative are applied. the result is a smooth ma that tracks prices very closely without any lag.
input parameters:
- periods: sets the low-pass filter's bandwidth, calculated as 1 / (2 * periods).
- taps: the number of delay elements in the filter. this must be an odd number. the filter requires taps price points to form a new smoothed ma value.
- window: selects the filter's approximation window:
window=1 - rectangular window
window=2 - hanning window
window=3 - hamming window
window=4 - blackman window
window=5 - blackman-harris window
on the chart, the first part of the ma, constructed by the digital filter, is displayed as a blue curve. the second part, built using cubic spline fitting, is displayed as a red curve.
afirma
You may also like: signals cs v to chart objects - excellent alternative for script users on MetaTrader 4.
Source Code
#property copyright "robotfx"
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 blue
#property indicator_color2 red
#property indicator_width1 2
#property indicator_width2 2
#define pi 3.141592653589793238462643383279502884197169399375105820974944592
extern int periods = 4; // 1/(2*periods) sets the filter bandwidth
extern int taps = 21; // must be an odd number
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.