#_i_FFT_separate_Speedometer_buy

Download script
Author: Copyright � 2006, klot.
#_i_FFT_separate_Speedometer_buy

This tool is designed to analyze and visualize the underlying "rhythm" of market price movements by using a sophisticated mathematical technique known as a Fast Fourier Transform (FFT). Instead of looking at simple price trends like standard indicators, this script treats financial data as a complex wave or signal, breaking it down into its individual frequencies to identify hidden patterns.

Core Logic and Workflow

The script operates through a multi-step process to clean and filter market noise:

1. Data Collection The tool begins by gathering a specific window of historical price data from an external "Speedometer" component. This represents the raw "velocity" or movement of the asset over a defined period.

2. Frequency Decomposition (Forward Transformation) Once the data is collected, the script performs a "Forward Fourier Transform." In non-technical terms, this takes a messy, jagged price chart and deconstructs it into various frequencies—much like how a prism breaks white light into individual colors. It identifies which parts of the price movement are rapid vibrations and which are slow, underlying cycles.

3. Precision Filtering This is where the core "analysis" happens. The script uses user-defined boundaries (Minimum and Maximum limits) to act as a filter. It deliberately ignores the high-frequency "noise" (tiny, erratic price flickers) and the ultra-low-frequency drifts, focusing only on the specific "sweet spot" of market cycles that the user wants to observe. By setting these limits, the tool suppresses irrelevant market interference.

4. Signal Reconstruction (Inverse Transformation) After filtering out the unwanted noise, the script performs an "Inverse Fourier Transform." It takes the remaining "clean" frequencies and reconstructs them back into a visible line.

Visual Result

The final output provided on your chart is a refined representation of the market's periodic behavior. By stripping away the chaos of random price fluctuations and highlighting only the dominant cycles within your chosen range, the tool provides a smoother, more structured view of how the market is actually "pulsing" at that moment.

Miscellaneous
Implements a curve of type %1
10 Views
0 Downloads
0 Favorites
#_i_FFT_separate_Speedometer_buy
//+------------------------------------------------------------------+
//|                                            #_i_SpecktrAnalis.mq4 |
//|                                          Copyright © 2006, klot. |
//|                                                     klot@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, klot."
#property link      "klot@mail.ru"



#import "#_lib_FFT.ex4"
void realfastfouriertransform(double& a[], int tnn, bool inversefft);
#import

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue
//#property indicator_color2 Blue
#property indicator_level1 0.0
//---- buffers
double Buffer1[];
//double Buffer2[];
//---
extern int n=7; // Äëèíà ðÿäà
extern int Fmin=2; // Ãðíèöà Ôèëüòðà ïî Í×.
extern int Fmax=30;//128; // Ãðàíèöà Ôèëüòðà ïî Â×.
//extern string sym="GBPUSD";
//extern string sym="EURUSD";

double aa[];
int N;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Buffer1);
//SetIndexStyle(1,DRAW_LINE);
//SetIndexBuffer(1,Buffer2);
//---
   N=MathPow(2,n);
   ArrayResize(aa,N);

if( Fmax>=N ) Fmax=N;
if( Fmin<=2 ) Fmin=2;

//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {

   if( Bars<N) return(0);
   
   //---
   for(int i=N-1; i>=0; i--) { aa[i]=iCustom(Symbol(),0,"Speedometer_v1_mod_v01",0,0,i); }
   //---
   realfastfouriertransform(aa, N, false);
   //---
   N=ArraySize(aa);
   //Comment("n= ",N);
   //---
   for( i=0; i<=N-1; i++) 
   { 
      if( i<Fmin || i>Fmax) { aa[i]=0.0; }
   }
   //---
   realfastfouriertransform(aa, N, true);
   //---
   SetIndexDrawBegin(0,Bars-N);
   //---
   for( i=0; i<=N-1; i++)
   {
      Buffer1[i]=aa[i];
   }
   //----
   return(0);
  }
//-------------------------------------------------------------------+

Comments