DT-ZigZag-Lauer_v1

Download script
Author: Copyright � 2005, klot
DT-ZigZag-Lauer_v1

This tool is designed to provide traders with a clearer visual representation of market structure by filtering out minor price fluctuations and highlighting significant trend reversals. It functions by identifying key "turning points" in the market and mapping them onto your trading chart as specific visual markers.

How it Works

1. Multi-Timeframe Analysis The logic doesn't just look at the current chart timeframe; instead, it references a much larger "Gross Period" (a higher timeframe). This allows the tool to identify major structural movements that might be obscured by the "noise" of smaller, shorter-term price action. By looking at the bigger picture, the script ensures that the signals provided are based on significant trends rather than temporary price spikes.

2. Dynamic Data Retrieval The script performs a sophisticated search through historical data to synchronize the current chart with the larger timeframe. It calculates the correct "shift" in time to ensure that the information being pulled from the higher timeframe aligns perfectly with the bars you are currently viewing on your screen.

3. Identification of Key Reversals At its core, the tool utilizes a specialized ZigZag calculation. It looks for specific price peaks and valleys—points where the market direction significantly changes. Rather than showing every small wiggle in the price, it focuses on the major structural levels defined by a user-set depth.

4. Visual Signal Logic Once a significant reversal point is identified from the higher timeframe, the script applies two distinct logic filters to place markers on your chart:

  • Bearish Markers: If the market's closing price falls below a detected structural level, the tool identifies this as a potential bearish area and places a corresponding red marker.
  • Bullish Markers: If the market's closing price remains above a detected structural level, it identifies this as a potential bullish area and places a blue marker.

Summary for Traders

Essentially, this script acts as a "trend filter." It strips away the minor volatility of the current chart to show you where the real structural boundaries are being formed on higher timeframes. By providing these visual anchors, it helps traders stay aligned with the dominant market direction and identify high-probability areas where the price may be reacting to major historical levels.

Price Data Components
Series array that contains close prices for each bar
Miscellaneous
Implements a curve of type %1It issuies visual alerts to the screen
13 Views
0 Downloads
0 Favorites
DT-ZigZag-Lauer_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                              DT-ZigZag-Lauer.mq4 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, klot"
#property link      "klot@mail.ru"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Blue
//---- input parameters
extern int       depth=5;
extern int GrossPeriod=240; 
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
datetime daytimes[]; 
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_ARROW);
   SetIndexArrow(0,159);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexEmptyValue(0,0.0);
   SetIndexStyle(1,DRAW_ARROW);
   SetIndexArrow(1,159);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexEmptyValue(1,0.0);
//----
//---- 
   if (Period()>GrossPeriod) { Alert("DT-ZigZag: Òåêóùèé òàéìôðåéì äîëæåí áûòü ìåíüøå ÷åì ", GrossPeriod); return(0); } 
   // Âñå Time[] ñåðèè âðåìåíè îòñîðòèðîâàíî â íàïðàâëåíèè óáûâàíèÿ 
   ArrayCopySeries(daytimes,MODE_TIME,Symbol(),GrossPeriod); 
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- 
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int    counted_bars=IndicatorCounted();
   int    limit=300,bigshift;
   double zigzag1;
   if (counted_bars<0) return(-1); 
    
   if (counted_bars>0) counted_bars--; 
    
   limit=Bars-counted_bars; 
//---- 
   for (int i=0; i<limit; i++) 
   { 
   if(Time[i]>=daytimes[0]) bigshift=0; 
   else 
     { 
      bigshift = ArrayBsearch(daytimes,Time[i-1],WHOLE_ARRAY,0,MODE_DESCEND); 
      if(Period()<=GrossPeriod) bigshift++; 
     } 
      for (int cnt=bigshift; cnt<(100+bigshift); cnt++)
      {
         zigzag1=iCustom(NULL,GrossPeriod,"ZigZag",depth,5,3,0,cnt+1);
         if ( zigzag1!=0 ) break;
      }
      
   if (  iClose(NULL,0,i+1)<=zigzag1 )  ExtMapBuffer2[i]=zigzag1; else ExtMapBuffer2[i]=0.0;
   if (  iClose(NULL,0,i+1)>=zigzag1  )  ExtMapBuffer1[i]=zigzag1; else ExtMapBuffer1[i]=0.0;
   ObjectsRedraw();
   }
 // Comment("zigzag1 = ",zigzag1);
//----
   return(0);
  }
//+------------------------------------------------------------------+

Comments