azzx_larryzz_3_0_AlexSTAL

Download script

This script is designed to act as a visual price action tool for the MetaTrader platform, specifically modeled after the "Larry Williams" trading method. It identifies significant structural points in the market—specifically "extremes" or "fractals"—to help traders visualize trend reversals and support/resistance levels.

Core Logic and Functionality

1. Identification of Extremes (Fractals) The primary logic of the script is to scan historical price data to identify peak highs and valley lows. It does this by comparing a specific candle's price against its neighbors. A point is only recognized as an "extreme" if it is higher (for a high) or lower (for a low) than the surrounding price action.

2. Multi-Level Hierarchy Unlike basic indicators that only show one type of peak, this script categorizes these extremes into different levels (up to three distinct tiers). This allows a trader to distinguish between minor fluctuations and major structural shifts in the market. It assigns different visual styles (colors and arrow types) to each level so they can be easily differentiated on the chart.

3. Trend Structure Visualization The script automatically draws "ZigZag" lines between these identified extreme points. These lines connect the highest peaks and lowest valleys, effectively "cleaning up" the market noise and showing the underlying trend of the price movement. When a new high or low is confirmed, the script plots specific arrows to signal that a structural point has been reached.

4. Performance Optimizations To ensure the platform remains responsive even with large amounts of historical data, the script includes several optimization features:

  • Fast Mode: A dedicated setting that allows the indicator to skip unnecessary repetitive calculations on every new tick, updating only when needed to save processing power.
  • Smart Iteration: The logic is designed to limit its search area based on the number of bars currently loaded, preventing the software from lagging during heavy data processing.

5. Dynamic Ranking The script uses a systematic "pass" logic where it evaluates points sequentially. It checks if a peak or valley meets the criteria for Level 1, then moves to Level 2, and so on. This hierarchical approach ensures that the most significant market movements are prioritized and clearly represented to the user.

Summary of User Experience

For a trader, this tool provides a visual "skeleton" of the price movement. Instead of seeing every tiny fluctuation, you see a clear path of major highs and lows connected by lines. It highlights key reversal zones with arrows, helping you identify where the market might be turning based on the structural extremes defined by the Larry Williams methodology.

Miscellaneous
Implements a curve of type %1
1 Views
0 Downloads
0 Favorites
azzx_larryzz_3_0_AlexSTAL
// ---------------------------------------------------------------------------
//  Çèãçàã ïî ýêñòðåìóìàì êàê ó Ë.Âèëüÿìñà.
//
//  Âåðñèÿ 2.0: Ââåäåíà îïòèìèçàöèÿ ïîñëåäîâàòåëüíîñòåé ýêñòðåìóìîâ.
//
//  Âåðñèÿ 3.0: Ââåä¸í ðåæèì "áûñòðîé" ðàáîòû ïî ñôîðìèðîâàâøèìñÿ áàðàì.
//              Ââåäåíà ïîäñâåòêà òð¸õ óðîâíåé ýêñòðåìóìîâ - êàê â êíèãå
//              Ëàððè Âèëüÿìñà.
//
//  Âåðñèÿ ñ èñïðàâëåíèÿìè AlexSTAL.
// ---------------------------------------------------------------------------

#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1  SkyBlue
#property indicator_color2  SkyBlue
#property indicator_color3  Lime
#property indicator_color4  Blue
#property indicator_color5  Red
#property indicator_color6  Lime
#property indicator_color7  Blue
#property indicator_color8  Red
#property indicator_width1  2
#property indicator_width2  2
#property indicator_width3  2
#property indicator_width4  2
#property indicator_width5  2
#property indicator_width6  2
#property indicator_width7  2
#property indicator_width8  2

// Êîäû ñòðåëîê.
#define ARROW_CODE_L1 0x9F
#define ARROW_CODE_L2 0x77
#define ARROW_CODE_L3 0x6C

// Ïàðàìåòðû èíäèêàòîðà.
extern int  ZZ_LINE_LEVEL = 2;    // Óðîâåíü ïðî÷åð÷èâàåìûõ ëèíèé.
extern bool FAST_MODE     = true; // Ðåæèì ðàáîòû ïî ñôîðìèðîâàâøèìñÿ áàðàì.

                                  // Áóôåðû èíäèêàòîðà.
double buf_zz1[],buf_zz2[],buf_l1up[],buf_l2up[],buf_l3up[],buf_l1down[],buf_l2down[],buf_l3down[];
int    maximum[],minimum[];
// Ïðåäåë óðîâíÿ, äî êîòîðîãî èùåì ýêñòðåìóìû.
int   max_level;
// Èíèöèàëèçàöèÿ.
int init() 
  {
   IndicatorShortName(StringConcatenate("AZZX - LARRYZZ v3.0 / Modified by AlexSTAL (",
                      ZZ_LINE_LEVEL,", ",FAST_MODE,")"));

   SetIndexBuffer(0,buf_zz1);
   SetIndexBuffer(1,buf_zz2);
   SetIndexBuffer(2,buf_l1up);
   SetIndexBuffer(3,buf_l2up);
   SetIndexBuffer(4,buf_l3up);
   SetIndexBuffer(5,buf_l1down);
   SetIndexBuffer(6,buf_l2down);
   SetIndexBuffer(7,buf_l3down);

   SetIndexStyle(0,DRAW_ZIGZAG);
   SetIndexStyle(1,DRAW_ZIGZAG);
   SetIndexStyle(2,DRAW_ARROW);
   SetIndexStyle(3,DRAW_ARROW);
   SetIndexStyle(4,DRAW_ARROW);
   SetIndexStyle(5,DRAW_ARROW);
   SetIndexStyle(6,DRAW_ARROW);
   SetIndexStyle(7,DRAW_ARROW);

   SetIndexArrow(2,ARROW_CODE_L1);
   SetIndexArrow(3,ARROW_CODE_L2);
   SetIndexArrow(4,ARROW_CODE_L3);
   SetIndexArrow(5,ARROW_CODE_L1);
   SetIndexArrow(6,ARROW_CODE_L2);
   SetIndexArrow(7,ARROW_CODE_L3);

   SetIndexEmptyValue(0,0);
   SetIndexEmptyValue(1,0);

   ArrayResize(maximum,Bars);
   ArrayResize(minimum,Bars);

   if(ZZ_LINE_LEVEL>3) 
     {
      max_level=ZZ_LINE_LEVEL;
        } else {
      max_level=3;
     }

   return(0);
  }
// Ãëàâíûé öèêë.
int start() 
  {
   int i,j;

// Ïîääåðæêà áûñòðîãî ðåæèìà ðàáîòû.
   if((FAST_MODE==true) && (Bars-IndicatorCounted()==1)) return(0);

   int counted_bars = IndicatorCounted();
   if(counted_bars < 0)  return(-1);
   if(counted_bars > 0)   counted_bars--;
   int limit = Bars - counted_bars;
   if(counted_bars==0) limit-=1+1;      

   ArrayResize(maximum,limit);
   ArrayResize(minimum,limit);
// Ïîèñê ýêñòðåìóìîâ.
   ArrayInitialize(maximum,0);
   ArrayInitialize(minimum,0);   

   for(i=1; i<=max_level; i++) pass(i,limit);

// Ïîñòðîåíèå èíäèêàòîðîâ.
   ArrayInitialize(buf_zz1,0);
   ArrayInitialize(buf_zz2,0);
   ArrayInitialize(buf_l1up,0);
   ArrayInitialize(buf_l2up,0);
   ArrayInitialize(buf_l3up,0);
   ArrayInitialize(buf_l1down,0);
   ArrayInitialize(buf_l2down,0);
   ArrayInitialize(buf_l3down,0);

   for(i=limit-1; i>=0; i--) 
     {
      if(maximum[i] >= ZZ_LINE_LEVEL) 
        {
         for(j = i + 1; j < limit; j++) 
           {
            buf_zz1[i]=High[i];

            if(minimum[j]>=ZZ_LINE_LEVEL) 
              {
               // Íîðìàëüíàÿ ñèòóàöèÿ.
               break;
                 } else if((maximum[i]>=ZZ_LINE_LEVEL) && (buf_zz1[i]>0)) {
               // Îñòàíåòñÿ òîëüêî îäèí...
               if(High[i]>High[j]) 
                 {
                  buf_zz1[j]=0;
                    } else {
                  buf_zz1[i]=0;
                 }
              }
           }
        }

      if(minimum[i] >= ZZ_LINE_LEVEL) 
        {
         for(j = i + 1; j < limit; j++) 
           {
            buf_zz2[i]=Low[i];

            if(maximum[j]>=ZZ_LINE_LEVEL) 
              {
               // Íîðìàëüíàÿ ñèòóàöèÿ.
               break;
                 } else if((minimum[i]>=ZZ_LINE_LEVEL) && (buf_zz2[i]>0)) {
               // Îñòàíåòñÿ òîëüêî îäèí...
               if(Low[i]<Low[j]) 
                 {
                  buf_zz2[j]=0;
                    } else {
                  buf_zz2[i]=0;
                 }
              }
           }
        }

      if(maximum[i] == 1) buf_l1up[i] = High[i];
      if(minimum[i] == 1) buf_l1down[i] = Low [i];

      if(maximum[i] == 2) buf_l2up[i] = High[i];
      if(minimum[i] == 2) buf_l2down[i] = Low [i];

      if(maximum[i] >= 3) buf_l3up[i] = High[i];
      if(minimum[i] >= 3) buf_l3down[i] = Low [i];
     }

   return(0);
  }
// Ïðîõîä ïî óðîâíþ.
// Âîçâðàùàåò true, åñëè áûëè íàéäåíû ýêñòðåìóìû çàäàííîãî óðîâíÿ.
bool pass(int level,int lim) 
  {
   return(pass_maximum(level,lim) || pass_minimum(level,lim));
  }
// Ïîèñê ìåíüøåãî èëè ðàâíîãî ìàêñèìóìà ñëåâà.
//  ñëó÷àå íåóäà÷è âîçâðàùàåò çàâåäîìî áîëüøîå ÷èñëî.
double find_left_maximum(int bar, int lim) 
  {
   int i,level=maximum[bar];

   for(i=bar+1; i<lim; i++) 
     {
      if(maximum[i]>=level) 
        {
         return(High[i]);
        }
     }

// Äîøëè äî êîíöà èñòîðèè.
   return(High[bar]+1);
  }
// Ïîèñê ìåíüøåãî èëè ðàâíîãî ìàêñèìóìà ñïðàâà.
//  ñëó÷àå íåóäà÷è âîçâðàùàåò çàâåäîìî áîëüøîå ÷èñëî.
double find_right_maximum(int bar) 
  {
   int i,level=maximum[bar];

   for(i=bar-1; i>= 0; i--) 
     {
      if(maximum[i]>= level) 
        {
         return(High[i]);
        }
     }

// Äîøëè äî íà÷àëà èñòîðèè.
   return(High[bar]+1);
  }
// Ïðîõîä ïî ìàêñèìóìàì äëÿ óðîâíÿ.
// Âîçâðàùàåò true, åñëè áûëè íàéäåíû ìàêñèìóìû.
bool pass_maximum(int level,int lim) 
  {
   int i,limit=lim-2,prev=level-1,result=false;

   for(i = 1; i<limit; i++) 
     {
      if(maximum[i] == prev) 
        {
         double l = find_left_maximum(i,limit);
         double r = find_right_maximum(i);

         if((l<=High[i] && r<High[i]) || (l<High[i] && r<=High[i])) 
           {
            maximum[i] = level;
            result     = true;
           }
        }
     }

   return(result);
  }
// Ïîèñê ìåíüøåãî èëè ðàâíîãî ìèíèìóìà ñëåâà.
//  ñëó÷àå íåóäà÷è âîçâðàùàåò çàâåäîìî ìåíüøåå ÷èñëî.
double find_left_minimum(int bar,int lim) 
  {
   int i,level=minimum[bar];

   for(i=bar+1; i<lim; i++) 
     {
      if(minimum[i]>=level) 
        {
         return(Low[i]);
        }
     }

// Äîøëè äî êîíöà èñòîðèè.
   return(Low[bar]-1);
  }
// Ïîèñê ìåíüøåãî èëè ðàâíîãî ìèíèìóìà ñïðàâà.
//  ñëó÷àå íåóäà÷è âîçâðàùàåò çàâåäîìî ìåíüøåå ÷èñëî.
double find_right_minimum(int bar) 
  {
   int i,level=minimum[bar];

   for(i=bar-1; i>= 0; i--) 
     {
      if(minimum[i]>= level) 
        {
         return(Low[i]);
        }
     }

// Äîøëè äî íà÷àëà èñòîðèè.
   return(Low[bar]-1);
  }
// Ïðîõîä ïî ìèíèìóìàì äëÿ óðîâíÿ.
// Âîçâðàùàåò true, åñëè áûëè íàéäåíû ìèíèìóìû.
bool pass_minimum(int level,int lim) 
  {
   int i,limit=lim-2,prev=level-1,result=false;

   for(i = 1; i<limit; i++) 
     {
      if(minimum[i] == prev) 
        {
         double l = find_left_minimum(i,lim);
         double r = find_right_minimum(i);

         if((l>=Low[i] && r>Low[i]) || (l>Low[i] && r>=Low[i])) 
           {
            minimum[i] = level;
            result     = true;
           }
        }
     }

   return(result);
  }
//+------------------------------------------------------------------+

Comments