#_FullSSA_normalize

Download script
Author: Copyright � 2007, klot
#_FullSSA_normalize

This technical indicator is designed to analyze market price movements by filtering out general market noise to identify specific underlying trends and potential reversal points. It achieves this through a multi-step mathematical process that normalizes data before applying a sophisticated decomposition technique.

Data Normalization Phase

The logic begins by evaluating the recent price history of an asset. Instead of looking at raw prices, the script calculates a moving average and the standard deviation—a measure of how much the price typically fluctuates. By subtracting the average from the current price and dividing it by the volatility (standard deviation), the tool creates a "normalized" data set. This effectively strips away the "background noise" of the market, leaving behind a streamlined representation of price behavior that is easier to analyze for significant changes.

Signal Processing via SSA

Once the data is normalized, the script employs a method known as Singular Spectrum Analysis (SSA). In simple terms, this acts like a prism for financial data; it breaks down the complex price history into different components (such as trends, cycles, and random noise). The script specifically focuses on isolating the most relevant patterns within these components to determine the "momentum" of the market.

Identification of Trading Signals

The final stage of the logic monitors these processed results in real-time to detect extreme conditions. The indicator looks for specific mathematical peaks and troughs:

  • Sell Signals: When the analysis detects a significant peak (an upper extreme) in the filtered data, it interprets this as a potential exhaustion point where the price may start to drop, triggering a visual "Sell" arrow on the chart.
  • Buy Signals: Conversely, when the analysis identifies a significant trough (a lower extreme), it suggests that the downward pressure has peaked and a move upward may be imminent, triggering a visual "Buy" arrow.

By combining statistical normalization with advanced decomposition, this tool aims to provide traders with clearer entry and exit points by focusing on the structural integrity of price movements rather than minor, insignificant fluctuations.

Indicators Used
Moving average indicatorStandard Deviation indicator
Miscellaneous
Implements a curve of type %1
21 Views
2 Downloads
0 Favorites
#_FullSSA_normalize
//+------------------------------------------------------------------+
//|                                                      FullSSA.mq4 |
//|                                           Copyright © 2007, klot |
//|                                                     klot@mail.ru |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, klot"
#property link      "klot@mail.ru"


#import "SSA.ex4" //"FullSSA.dll"
 void fastsingular(double a[],int n,int lag,int s,double& b[]);
#import


#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Yellow
#property indicator_level1 0.0
//----
   extern int Lag=10;
   extern int NumComps=2;
   extern  int PeriodNorm=10;
   extern int N=300;

   double arryTimeSeries[];
//---- buffers
double SSA[];

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,SSA);
   ArrayResize(arryTimeSeries,N);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
//----
   SetIndexDrawBegin(0,Bars-N);
   double dev,ma;
   int i, nmax, nmin;
   //---
   for( i=N-1; i>=0; i--) {
   //-----
      ma=iMA(NULL,0,PeriodNorm,0,MODE_SMA,PRICE_CLOSE,i);
      dev=3*iStdDev(NULL,0,PeriodNorm,0,MODE_SMA,PRICE_CLOSE,i);
      if(dev==0) dev=0.1;
      arryTimeSeries[i]=(Close[i]-ma)/dev;//iDeMarker(NULL,0,PeriodNorm,i);
   }
   fastsingular(arryTimeSeries,N,Lag,NumComps,SSA);
   nmax=ArrayMaximum(SSA,3,1);
   nmin=ArrayMinimum(SSA,3,1);
   if(nmax==2) {
            ObjectCreate("Sell"+Time[0],OBJ_ARROW,0,Time[0],Open[0]);
            ObjectSet("Sell"+Time[0],OBJPROP_ARROWCODE,226);
   }
   if(nmin==2) {
            ObjectCreate("Buy"+Time[0],OBJ_ARROW,0,Time[0],Open[0]);
            ObjectSet("Buy"+Time[0],OBJPROP_ARROWCODE,225);
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments