#_i_FFT_separate_Speed_WABSV2_sell
Download scriptThis tool, known as the SpecktrAnalis, is designed to provide a specialized visual analysis of market price movement by transforming standard price data into its underlying frequency components. Instead of looking at the raw "noise" of price charts, this script analyzes the rhythm and cycle of the market to help identify significant patterns.
How the Logic Works
1. Data Collection The script begins by gathering specific momentum or speed data from a secondary technical source (specifically, a weighted average calculation). It looks back at a set number of recent bars to build a foundation of movement history.
2. Frequency Transformation The core engine of this tool uses a mathematical process called a "Fast Fourier Transform." In simple terms, this is the same logic used in high-end audio engineering to break down a complex sound wave into individual notes. The script takes the messy price movements and breaks them down into their constituent "frequencies"—essentially separating the underlying trends from the temporary market fluctuations.
3. Filtering the Signal Once the data is broken down into frequencies, the tool applies a custom filter based on two user-defined limits (Minimum and Maximum):
- It identifies the specific range of frequencies that are most relevant to the trader’s strategy.
- It suppresses or "mutes" everything outside of this range, effectively cleaning out unnecessary market noise and leaving only the significant signals.
4. Reconstruction and Visualization After filtering out the noise, the script performs an inverse transformation. This reconstructs the data back into a visible format that is mapped onto your trading window. The final result is a smoothed line that highlights the most dominant rhythmic patterns in the market, allowing for a clearer view of price cycles than standard indicators might provide.
Key Adjustments
The user can fine-tune how the tool "listens" to the market by adjusting three main parameters:
- Data Depth: Determines how many historical bars are used to calculate the initial movement.
- Minimum Frequency: Sets the floor for which cycles to ignore (filtering out very slow, long-term movements).
- Maximum Frequency: Sets the ceiling for which cycles to keep (filtering out very fast, erratic "jitter" or noise).
//+------------------------------------------------------------------+
//| #_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
//---- 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,"Speed_WABSV2",true,0,1,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