DT-ZigZag-Lauer
Download scriptOverview
The DT-ZigZag-Lauer tool is designed to assist traders in identifying significant price structure and trend reversals by analyzing historical price movements. It works by filtering out minor market "noise" and highlighting key turning points where the price has shifted direction significantly.
How it Works
The logic behind this script can be broken down into three main components:
1. Timeframe Coordination The tool is designed to look at the "big picture." It utilizes a specific timeframe (defined by the GrossPeriod setting) to determine major price movements. This ensures that the signals provided are based on substantial trends rather than small, fleeting fluctuations in price. If you attempt to use it on a timeframe larger than this set limit, the tool will notify you to ensure the data remains consistent.
2. Trend Identification (ZigZag Analysis) The script pulls data from a standard "ZigZag" calculation. In technical analysis, a ZigZag is used to connect major highs and lows, making it easier to see the underlying shape of a market's path. This script takes those identified peaks and valleys and uses them as reference points to determine whether the current price is moving higher or lower relative to recent historical highs/lows.
3. Dynamic Signal Mapping Once the major turning points are identified, the script performs a continuous check on the current market price:
- Downward Signals: If the current closing price falls below a significant peak (a ZigZag point), the tool marks that level with a specific visual indicator (Red).
- Upward Signals: If the current closing price rises above a significant valley (a ZigZag point), it marks that level with a different visual indicator (Blue).
Summary for Traders
Essentially, this tool acts as a visual filter. It scans the market to find major structural peaks and valleys based on a set depth of price movement. By marking these points on your chart, it helps you visualize where the trend has shifted, allowing you to see "support" and "resistance" zones more clearly without being distracted by small, insignificant price ticks.
//+------------------------------------------------------------------+
//| 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