SZZ_without_ZZ

Download script
Author:
SZZ_without_ZZ

This script is designed to function as a specialized technical analysis tool for the MetaTrader platform, specifically engineered to work in tandem with the SZZReader system. Its primary purpose is to identify and map specific price action patterns by analyzing the historical movement of market data.

Core Logic and Methodology

The tool operates by transforming standard price data into a smoothed "path" or "snake." Instead of looking at raw prices—which can be volatile and noisy—the logic uses a custom weighted formula to calculate a significant "navel" point for each price bar. This calculation prioritizes the closing price while still factoring in the opening, high, and low points to create a more balanced representation of market momentum.

How the Analysis Works

  1. Smoothing the Movement: The script processes these weighted points to create a continuous sequence known as the "Snake." By averaging adjacent points, it filters out minor market fluctuations to reveal the underlying trend.
  2. Trend Identification: The tool continuously scans the "Snake" to identify shifts in direction. It specifically looks for moments where the path changes from upward momentum to downward momentum (and vice versa).
  3. Pattern Tracking: Once a change in direction is detected, the script begins a recursive search to identify specific structural landmarks. Depending on whether the market is moving up or down, it automatically searches for:
    • The highest peaks (in downtrends)
    • The lowest troughs (in uptrends)
  4. Sequential Mapping: The script is configured to track a specific number of these movements (defined by the user as "Units"). It builds a chronological map of these significant price swings, allowing it to visualize the structure of the market over a set period starting from a user-defined point in time.

User Experience and Output

For the end-user, this logic translates into a visual representation of structural price action. Rather than showing every minor tick in the market, it highlights the significant "zig-zags" or turns in the trend. It provides a cleaned, structured view of the data, making it easier to see the broader architecture of price movements over time.

Miscellaneous
It issuies visual alerts to the screen
12 Views
0 Downloads
0 Favorites
SZZ_without_ZZ
//+------------+-----------------------------------------------------+
//| v.05.01.08 |                                  SZZ_without_ZZ.mq4 |
//|            |              Bookkeeper, 2008, yuzefovich@gmail.com |
//+------------+-----------------------------------------------------+
// Äàííûé èíäèêàòîð ïðåäíàçíà÷åí òîëüêî äëÿ èñïîëüçîâàíèÿ â SZZReader.
// The given indicator is intended for use in SZZReader only.
//+------------+-----------------------------------------------------+
#property copyright ""
#property link      ""
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1  Blue
#property indicator_color2  Blue
//----
extern datetime FirstBarTime=0; // íå ìåíÿòü!
extern int NUnits=10; // ñ÷èòàòü êîëè÷åñòâî óçëîâ ÇèãÇàãà
//----                                      
double NumBars[];
double UpAndDn[];
double BarToBar[];
double Snake[];
//----
bool first=true, firstAlert=true;
datetime StartTime;
//----
//---------------------------------------------------------------------
double Navel(int Shift)
{
   // Òóøêà ñâå÷è äîëæíà áîëüøå ÷åì òåíè âëèÿòü íà öåíó ñâå÷è (?)
   return((5*Close[Shift]+2*Open[Shift]+High[Shift]+Low[Shift])/9);
}
//+------------------------------------------------------------------+
void deinit() 
{
   return; 
}
//---------------------------------------------------------------------
int init()
{
int    draw_begin;
   IndicatorBuffers  (4);
   SetIndexBuffer    (0,NumBars);
   SetIndexStyle     (0,DRAW_LINE);
   SetIndexBuffer    (1,UpAndDn);
   SetIndexStyle     (1,DRAW_LINE);
   SetIndexBuffer    (2,BarToBar);
   SetIndexStyle     (2,DRAW_NONE);
   SetIndexEmptyValue(2,0.0);
   SetIndexBuffer    (3,Snake);
   SetIndexStyle     (3,DRAW_NONE);
   SetIndexEmptyValue(3,0.0);
   return(0);
}
//---------------------------------------------------------------------
void CalcSnake(int Pos)
{  
   Snake[Pos]=(Navel(Pos+1)+Navel(Pos)*2+Navel(Pos-1))/4;
   return;
}
//---------------------------------------------------------------------
int start()
{
   if(FirstBarTime==0) StartTime=Time[0];
   else StartTime=FirstBarTime;
   int n=iBarShift(Symbol(),Period(),StartTime);
   Snake[n]=(Navel(n)*3+Navel(n+1)*2+Navel(n+2))/6;
   BarToBar[n]=Snake[n];
   int i=n+1;
   BarToBar[i]=0;
   CalcSnake(i);
   while(Snake[n]==Snake[i]) 
      { i++; CalcSnake(i); BarToBar[i]=0; }
   int nu=0;
   NumBars[nu]=1.0*n;
   if(Snake[n]>Snake[i]) UpAndDn[nu]=1.0;
   else UpAndDn[nu]=-1.0;
   int k=n;
   while(nu<NUnits+2)
   {
      if(UpAndDn[nu]>0)
      {
         while(Snake[i-1]>=Snake[i] && i<Bars-3) 
         {
            i++; 
            CalcSnake(i);
            BarToBar[i]=0;
         }
         if(i==Bars-3)
         {
            if(firstAlert==true)
            {
               Alert("i=Bars-3 && nu<NUnits");
               firstAlert=false;
            }
            return(0);
         }
         BarToBar[i-1]=Snake[i-1];
         if(nu==0) k++;
         else if(nu<NUnits+1)
         {
            k=iHighest(NULL,0,MODE_HIGH,i-k-1,k);
            NumBars[nu]=1.0*k;
            k++;
         }
         nu++;
         UpAndDn[nu]=-1.0;
      }
      if(UpAndDn[nu]<0)
      {
         while(Snake[i-1]<=Snake[i] && i<Bars-3) 
         {
            i++; 
            CalcSnake(i);
            BarToBar[i]=0;
         }
         if(i==Bars-3)
         {
            if(firstAlert==true)
            {
               Alert("i=Bars-3 && nu<NUnits");
               firstAlert=false;
            }
            return(0);
         }
         BarToBar[i-1]=Snake[i-1];
         if(nu==0) k++;
         else if(nu<NUnits+1)
         {
            k=iLowest(NULL,0,MODE_LOW,i-k-1,k);
            NumBars[nu]=1.0*k;
            k++;
         }
         nu++;
         UpAndDn[nu]=1.0;
      }
   }
   for(i=NUnits+1;i<NUnits+4;i++)
   {
      UpAndDn[i]=0;
      NumBars[i]=0;
   }
   return(0);
}
//---------------------------------------------------------------------

Comments