[MT4指标]DT-ZZ折线指标
主图指标,DT-ZZ折线指标
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:有
//+------------------------------------------------------------------+
//| DT_ZZ.mq4 |
//+------------------------------------------------------------------+
#property copyright \"Copyright ? 2006, klot.\"
#property link \"[email protected]\"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Aqua
#property indicator_color2 Blue
#property indicator_color3 Red
//---- indicator parameters
extern int ExtDepth=12;
//---- indicator buffers
double zzL;
double zzH;
double zz;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
// IndicatorBuffers(3);
//---- drawing settings
SetIndexStyle(2,DRAW_ARROW);
SetIndexStyle(1,DRAW_ARROW);
SetIndexStyle(0,DRAW_SECTION);
SetIndexArrow(2,159);
SetIndexArrow(1,159);
//---- indicator buffers mapping
SetIndexBuffer(0,zz);
SetIndexBuffer(1,zzH);
SetIndexBuffer(2,zzL);
SetIndexEmptyValue(0,0.0);
SetIndexEmptyValue(1,0.0);
SetIndexEmptyValue(2,0.0);
//---- indicator short name
IndicatorShortName(\"DT_ZZ(\"+ExtDepth+\")\");
//---- initialization done
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
int i,shift,pos,lasthighpos,lastlowpos,curhighpos,curlowpos;
double curlow,curhigh,lasthigh,lastlow;
double min, max;
ArrayInitialize(zz,0.0);
ArrayInitialize(zzL,0.0);
ArrayInitialize(zzH,0.0);
lasthighpos=Bars; lastlowpos=Bars;
lastlow=Low[Bars];lasthigh=High[Bars];
for(shift=Bars-ExtDepth; shift>=0; shift--)
{
curlowpos=Lowest(NULL,0,MODE_LOW,ExtDepth,shift);
curlow=Low[curlowpos];
curhighpos=Highest(NULL,0,MODE_HIGH,ExtDepth,shift);
curhigh=High[curhighpos];
//------------------------------------------------
if( curlow>=lastlow ) { lastlow=curlow; }
else
{
//桎屐 忭桤
if( lasthighpos>curlowpos )
{
zzL[curlowpos]=curlow;
///*
min=100000; pos=lasthighpos;
for(i=lasthighpos; i>=curlowpos; i--)
{
if (zzL==0.0) continue;
if (zzLcurhighpos )
{
zzH[curhighpos]=curhigh;
///*
max=-100000; pos=lastlowpos;
for(i=lastlowpos; i>=curhighpos; i--)
{
if (zzH==0.0) continue;
if (zzH>max) { max=zzH; pos=i; }
zz=0.0;
}
zz[pos]=max;
//*/
}
lasthighpos=curhighpos;
lasthigh=curhigh;
}
//----------------------------------------------------------------------
}
return(0);
}
//+------------------------------------------------------------------+