#_i_FFT_separate_Volume

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

This tool is designed to analyze market dynamics by examining the underlying "frequencies" of trading volume. Rather than looking at simple price movements, it treats the flow of volume as a complex wave and uses mathematical techniques to break that wave down into its individual components.

How the Logic Works

1. Data Collection The script begins by gathering a specific amount of historical volume data from the current chart. It looks back at a set number of bars (determined by the user) to create a snapshot of how much trading activity has occurred over that period.

2. Frequency Transformation Once the volume data is collected, the tool applies a mathematical process known as a Fast Fourier Transform. In simple terms, this converts the raw volume data from the "time domain" (how much was traded at specific moments) into the "frequency domain." This allows the tool to see which types of cycles—fast, medium, or slow—are dominating the current market activity.

3. Signal Filtering The script then applies a specialized filter. By allowing the user to set minimum and maximum frequency boundaries, the tool can ignore certain types of "noise" in the market. It effectively carves out specific patterns, filtering out insignificant fluctuations while highlighting the core structural rhythms of the trading volume.

4. Reconstruction and Visualization After filtering the data, the tool performs an inverse transformation. This takes those filtered frequencies and converts them back into a readable format. The final result is plotted as a line on a separate window, providing a smoothed, refined view of the market's core volume trends, stripped of the distractions found in standard raw data.

Key Parameters

  • Time Window (n): Determines how much historical data the tool looks at to build its analysis.
  • Frequency Limits (Fmin & Fmax): These act as your "lens" settings, allowing you to focus on specific types of market rhythms and block out unwanted volatility or data spikes.
Price Data Components
Series array that contains tick volumes of each bar
Miscellaneous
Implements a curve of type %1
9 Views
0 Downloads
0 Favorites
#_i_FFT_separate_Volume
//+------------------------------------------------------------------+
//|                                            #_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 Red
//#property indicator_color2 Blue
#property indicator_level1 0.0
//#property indicator_level1 0.0
//#property indicator_level1 0.0
//---- buffers
double Buffer1[];
//double Buffer2[];
//---
extern int n=7; // Äëèíà ðÿäà
extern int Fmin=2;//2; // Ãðíèöà Ôèëüòðà ïî Í×.
extern int Fmax=50;//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]=iVolume(Symbol(),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