Fourier with SMA
- Indicatori
- FERNANDO JAVIER DE MENDONCA
- Versione: 1.29
- Attivazioni: 5
This indicator is a reconstruction of the price or price signal using the inverse Fourier transform; what it does is capture the amplitudes and frequencies of the various sine waves which, when summed, provide an approximate reconstruction of the price. This reconstruction is performed by considering the percentage of sine waves we choose to retain (in the *Percentage of frequencies to retain* parameter). In practice, choosing low values for this parameter smoothes the price to determine trends. When the indicator is above the moving average, it is a signal of a bullish trend, and when it is below the moving average, it is a signal of a bearish trend. The warning that can be given in this case is not to use the indicator in isolation (Use with other indicators, filters, or analyses.) and to seek, as much as possible, the parameter configuration that best suits your strategy.
### Explanation of its parameters
* Indicator Period
* Percentage of frequencies to retain
* SMA Period
Indicator Period: The period over which the indicator is calculated.
Percentage of frequencies to retain: Measured in allowed values from 15 to 100. If it exceeds 100, it results in an error; less than 15 does not guarantee its functionality. This parameter is the percentage of frequencies from the signal reconstruction to be maintained: 15% retains the lowest frequencies, which could be seen as a smoothed version of the price where the low frequencies reconstructing the price signal can determine its trends. As its value increases, more frequencies are incorporated; if the value is high, it incorporates higher frequencies, meaning that the reconstruction of the price signal more closely resembles the price of the financial instrument to which it is applied.
SMA_Period: The period of the moving average applied to the indicator or price signal reconstruction.
In EA MT5 development, use Buffer 0 → signal (reconstructed DFT)
Use Buffer 1 → moving average (SMA), Partial code example(Don’t forget to optimize your strategy parameters through robustness testing.):
"int OnInit()
{
handle = iCustom(_Symbol, _Period, IndicatorName,Indicator_Period,percentfreq,smaperiod);
if(handle == INVALID_HANDLE)
{
Print("Error init indicator");
return(INIT_FAILED);
}..."
"void OnTick()
{,,,
...
// copy buffers
if(CopyBuffer(handle, 0, 0, 3, bufferSignal) <= 0) return;
if(CopyBuffer(handle, 1, 0, 3, bufferMA) <= 0) return;
ArraySetAsSeries(bufferSignal, true);
ArraySetAsSeries(bufferMA, true);
// valores actuales y previos
double sig0 = bufferSignal[0];
double sig1 = bufferSignal[1];
…"
