[MT4指标]Ichimoku+GuppyAlligator2指标
主图指标,一幕均衡表的变种 可以参考一下
mt4指标类型:趋势指标
是否能用在mt4手机版上:否
是否含有未来函数:无
//+------------------------------------------------------------------+
//| Ichimoku+GuppyAlligator2.mq4 |
//| Copyright ? 2009, 擔乆僩儗FX!. |
//|丂巊梡姶憐側偳丄椙偄埆偄偳偪傜偱傕偁偭偰傕姶憐捀偗傟偽婐偟偄偱偡侓|
//| http://fx-insanity-trade.seesaa.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ? 2009, 擔乆僩儗FX!."
#property link "http://fx-insanity-trade.seesaa.net/"
#property indicator_chart_window
#property indicator_buffers 8
#property indicator_color1 Yellow
#property indicator_color2 Pink
#property indicator_color3 Pink
#property indicator_color4 Pink
#property indicator_color5 Aqua
#property indicator_color6 Aqua
#property indicator_color7 Aqua
#property indicator_color8 Aqua
//---- input parameters
extern int Tenkan1=1;
extern int Tenkan2=2;
extern int Tenkan3=3;
extern int Tenkan4=4;
extern int Kijun1=18;
extern int Kijun2=19;
extern int Kijun3=20;
extern int Kijun4=21;
//---- buffers
double Tenkan1_Buffer;
double Tenkan2_Buffer;
double Tenkan3_Buffer;
double Tenkan4_Buffer;
double Kijun1_Buffer;
double Kijun2_Buffer;
double Kijun3_Buffer;
double Kijun4_Buffer;
//----
int a_begin;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,Tenkan1_Buffer);
SetIndexDrawBegin(0,Tenkan1-1);
SetIndexLabel(0,"Tenkan1");
SetIndexStyle(1,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(1,Tenkan2_Buffer);
SetIndexDrawBegin(1,Tenkan2-1);
SetIndexLabel(1,"Tenkan2");
SetIndexStyle(2,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(2,Tenkan3_Buffer);
SetIndexDrawBegin(2,Tenkan3-1);
SetIndexLabel(2,"Tenkan3");
SetIndexStyle(3,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(3,Tenkan4_Buffer);
SetIndexDrawBegin(3,Tenkan4-1);
SetIndexLabel(3,"Tenkan4");
//----
SetIndexStyle(4,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(4,Kijun1_Buffer);
SetIndexDrawBegin(4,Kijun1-1);
SetIndexLabel(4,"Kijun1");
SetIndexStyle(5,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(5,Kijun2_Buffer);
SetIndexDrawBegin(5,Kijun2-1);
SetIndexLabel(5,"Kijun2");
SetIndexStyle(6,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(6,Kijun3_Buffer);
SetIndexDrawBegin(6,Kijun3-1);
SetIndexLabel(6,"Kijun3");
SetIndexStyle(7,DRAW_LINE,STYLE_DOT);
SetIndexBuffer(7,Kijun4_Buffer);
SetIndexDrawBegin(7,Kijun4-1);
SetIndexLabel(7,"Kijun4");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Ichimoku Kinko Hyo |
//+------------------------------------------------------------------+
int start()
{
int i,k;
int counted_bars=IndicatorCounted();
double high,low,price;
//----
if(Bars<=Tenkan1 || Bars<=Tenkan2 || Bars<=Tenkan3 || Bars<=Tenkan4 || Bars<=Kijun1 || Bars<=Kijun2 || Bars<=Kijun3 || Bars<=Kijun4) return(0);
//---- initial zero
if(counted_bars<1)
{
for(i=1;i<=Tenkan1;i++) Tenkan1_Buffer[Bars-i]=0;
for(i=1;i<=Tenkan2;i++) Tenkan2_Buffer[Bars-i]=0;
for(i=1;i<=Tenkan3;i++) Tenkan3_Buffer[Bars-i]=0;
for(i=1;i<=Tenkan4;i++) Tenkan4_Buffer[Bars-i]=0;
for(i=1;i<=Kijun1;i++) Kijun1_Buffer[Bars-i]=0;
for(i=1;i<=Kijun2;i++) Kijun2_Buffer[Bars-i]=0;
for(i=1;i<=Kijun3;i++) Kijun3_Buffer[Bars-i]=0;
for(i=1;i<=Kijun4;i++) Kijun4_Buffer[Bars-i]=0;
}
//---- Tenkan1
i=Bars-Tenkan1;
if(counted_bars>Tenkan1) i=Bars-counted_bars-1;
while(i>=0)
{
high=High; low=Low; k=i-1+Tenkan1;
while(k>=i)
{
price=High[k];
if(highprice) low=price;
k--;
}
Tenkan1_Buffer=(high+low)/2;
i--;
}
//---- Tenkan2
i=Bars-Tenkan2;
if(counted_bars>Tenkan2) i=Bars-counted_bars-1;
while(i>=0)
{
high=High; low=Low; k=i-1+Tenkan2;
while(k>=i)
{
price=High[k];
if(highprice) low=price;
k--;
}
Tenkan2_Buffer=(high+low)/2;
i--;
}
//---- Tenkan3
i=Bars-Tenkan3;
if(counted_bars>Tenkan3) i=Bars-counted_bars-1;
while(i>=0)
{
high=High; low=Low; k=i-1+Tenkan3;
while(k>=i)
{
price=High[k];
if(highprice) low=price;
k--;
}
Tenkan3_Buffer=(high+low)/2;
i--;
}
//---- Tenkan4
i=Bars-Tenkan4;
if(counted_bars>Tenkan4) i=Bars-counted_bars-1;
while(i>=0)
{
high=High; low=Low; k=i-1+Tenkan4;
while(k>=i)
{
price=High[k];
if(highprice) low=price;
k--;
}
Tenkan4_Buffer=(high+low)/2;
i--;
}
//---- Kijun1
i=Bars-Kijun1;
if(counted_bars>Kijun1) i=Bars-counted_bars-1;
while(i>=0)
{
high=High; low=Low; k=i-1+Kijun1;
while(k>=i)
{
price=High[k];
if(highprice) low=price;
k--;
}
Kijun1_Buffer=(high+low)/2;
i--;
}
//---- Kijun2
i=Bars-Kijun2;
if(counted_bars>Kijun2) i=Bars-counted_bars-1;
while(i>=0)
{
high=High; low=Low; k=i-1+Kijun2;
while(k>=i)
{
price=High[k];
if(highprice) low=price;
k--;
}
Kijun2_Buffer=(high+low)/2;
i--;
}
//---- Kijun3
i=Bars-Kijun3;
if(counted_bars>Kijun3) i=Bars-counted_bars-1;
while(i>=0)
{
high=High; low=Low; k=i-1+Kijun3;
while(k>=i)
{
price=High[k];
if(highprice) low=price;
k--;
}
Kijun3_Buffer=(high+low)/2;
i--;
}
//---- Kijun4
i=Bars-Kijun4;
if(counted_bars>Kijun4) i=Bars-counted_bars-1;
while(i>=0)
{
high=High; low=Low; k=i-1+Kijun4;
while(k>=i)
{
price=High[k];
if(highprice) low=price;
k--;
}
Kijun4_Buffer=(high+low)/2;
i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Ichimoku+GuppyAlligator2.jpg
