#_i_FFT_separate_Speedometer_sell
Download scriptTechnical Logic Overview
This script functions as a specialized visual analysis tool designed to filter and isolate specific types of market movements. Instead of looking at price action in the traditional way (simple highs and lows), it treats the flow of the market as a wave, similar to how sound or radio signals are processed to remove background noise.
Core Mechanism
The logic operates through a three-step process of data transformation:
- Data Collection: The script begins by gathering a specific set of data points from a secondary source (the "Speedometer" indicator). It looks at a predefined window of recent market activity to understand the current momentum and velocity of the price.
- Frequency Analysis: Once it has this data, it applies a mathematical technique known as a Fast Fourier Transform. In simple terms, this takes a complex, jagged movement (like a volatile price chart) and breaks it down into individual "frequencies." Think of this like taking a recorded song and identifying the individual notes that make it up, rather than just hearing one messy sound.
- Filtering & Reconstruction: This is where the core "filtering" happens. The user can set specific boundaries (Minimum and Maximum frequencies). The script identifies which parts of the price movement are "noise" (high-frequency jitter or low-frequency trend shifts) and removes them based on those limits. After the unwanted noise is discarded, it performs an inverse transformation to rebuild the signal.
Visual Result
The final output is a smoothed, refined representation of market movement. By stripping away the "interference" of minor price fluctuations, the indicator aims to show the underlying rhythm or "heartbeat" of the market. It allows you to see the core trend more clearly by mathematically ignoring the distractions that often clutter a standard trading chart.
Key Parameters
- Area (n): Determines the size of the historical window the script looks at to perform its calculations.
- Fmin & Fmax: These act as your "tuning knobs." They allow you to decide which parts of the market movement you want to keep and which you want to hide, effectively customizing how much smoothing or detail is visible in the final result.
//+------------------------------------------------------------------+
//| #_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,"Speedometer_v1_mod_v01",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