mq4 gu bi xian bian se

来源:互联网 发布:哆啦a梦 日本战败 知乎 编辑:程序博客网 时间:2024/05/01 09:30
//+------------------------------------------------------------------+//|                  Guppy Mulitple Moving Average (Short double).mq4|//|                                                  candlexu@163.Com|//|                                                                  |//+------------------------------------------------------------------+#property copyright "2008 candlexu"#property indicator_chart_window//#property indicator_separate_window#property indicator_buffers 6#property indicator_color1 Aqua//Magenta#property indicator_color2 Red#property indicator_color3 Aqua#property indicator_color4 Red#property indicator_color5 Aqua#property indicator_color6 Redextern int long_26=  26;extern int long_30=  30;extern int long_35=  35;//---- buffersdouble ExtMapBuffer1[];double ExtMapBuffer1_1[];double ExtMapBuffer2[];double ExtMapBuffer2_2[];double ExtMapBuffer3[];double ExtMapBuffer3_3[];//+------------------------------------------------------------------+//| Custom indicator initialization function                         |//+------------------------------------------------------------------+int init()  {//---- indicators   SetIndexStyle(0,DRAW_LINE);   SetIndexBuffer(0,ExtMapBuffer1);   SetIndexStyle(1,DRAW_LINE);   SetIndexBuffer(1,ExtMapBuffer1_1);   SetIndexStyle(2,DRAW_LINE);   SetIndexBuffer(2,ExtMapBuffer2);   SetIndexStyle(3,DRAW_LINE);   SetIndexBuffer(3,ExtMapBuffer2_2);   SetIndexStyle(4,DRAW_LINE);   SetIndexBuffer(4,ExtMapBuffer3);   SetIndexStyle(5,DRAW_LINE);   SetIndexBuffer(5,ExtMapBuffer3_3);   //----   return(0);  }int deinit()  {   return(0);  }int start()  {   int i,j,limit,counted_bars=IndicatorCounted();         if(counted_bars<0) return(-1);   if(counted_bars>0) counted_bars--;   limit=Bars-counted_bars;      for(i=0; i<limit; i++){      ExtMapBuffer1[i]=iMA(NULL,0,long_26,0,MODE_EMA,PRICE_CLOSE,i);      ExtMapBuffer2[i]=iMA(NULL,0,long_30,0,MODE_EMA,PRICE_CLOSE,i);      ExtMapBuffer3[i]=iMA(NULL,0,long_35,0,MODE_EMA,PRICE_CLOSE,i);         }  for(j = Bars-counted_bars-1;j>=0;j--)  {      if(ExtMapBuffer1[j]>ExtMapBuffer1[j+1]) ExtMapBuffer1_1[j]=ExtMapBuffer1[j]; else ExtMapBuffer1_1[j]=EMPTY_VALUE;      if(ExtMapBuffer2[j]>ExtMapBuffer2[j+1]) ExtMapBuffer2_2[j]=ExtMapBuffer2[j]; else ExtMapBuffer2_2[j]=EMPTY_VALUE;      if(ExtMapBuffer3[j]>ExtMapBuffer3[j+1]) ExtMapBuffer3_3[j]=ExtMapBuffer3[j]; else ExtMapBuffer3_3[j]=EMPTY_VALUE;  }   return(0);  }//+------------------------------------------------------------------+



//+------------------------------------------------------------------+//|                  Guppy Mulitple Moving Average (Short double).mq4|//|                                                  candlexu@163.Com|//|                                                                  |//+------------------------------------------------------------------+#property copyright "2008 candlexu"#property indicator_chart_window//#property indicator_separate_window#property indicator_buffers 6#property indicator_color1 Aqua//Magenta#property indicator_color2 Red#property indicator_color3 Aqua#property indicator_color4 Red#property indicator_color5 Aqua#property indicator_color6 Redextern int long_40=  40;extern int long_45=  45;extern int long_50=  50;//---- buffersdouble ExtMapBuffer1[];double ExtMapBuffer1_1[];double ExtMapBuffer2[];double ExtMapBuffer2_2[];double ExtMapBuffer3[];double ExtMapBuffer3_3[];//+------------------------------------------------------------------+//| Custom indicator initialization function                         |//+------------------------------------------------------------------+int init()  {//---- indicators   SetIndexStyle(0,DRAW_LINE);   SetIndexBuffer(0,ExtMapBuffer1);   SetIndexStyle(1,DRAW_LINE);   SetIndexBuffer(1,ExtMapBuffer1_1);   SetIndexStyle(2,DRAW_LINE);   SetIndexBuffer(2,ExtMapBuffer2);   SetIndexStyle(3,DRAW_LINE);   SetIndexBuffer(3,ExtMapBuffer2_2);   SetIndexStyle(4,DRAW_LINE);   SetIndexBuffer(4,ExtMapBuffer3);   SetIndexStyle(5,DRAW_LINE);   SetIndexBuffer(5,ExtMapBuffer3_3);   //----   return(0);  }int deinit()  {   return(0);  }int start()  {   int i,j,limit,counted_bars=IndicatorCounted();         if(counted_bars<0) return(-1);   if(counted_bars>0) counted_bars--;   limit=Bars-counted_bars;      for(i=0; i<limit; i++){      ExtMapBuffer1[i]=iMA(NULL,0,long_40,0,MODE_EMA,PRICE_CLOSE,i);      ExtMapBuffer2[i]=iMA(NULL,0,long_45,0,MODE_EMA,PRICE_CLOSE,i);      ExtMapBuffer3[i]=iMA(NULL,0,long_50,0,MODE_EMA,PRICE_CLOSE,i);   }  for(j = Bars-counted_bars-1;j>=0;j--)  {      if(ExtMapBuffer1[j]>ExtMapBuffer1[j+1]) ExtMapBuffer1_1[j]=ExtMapBuffer1[j]; else ExtMapBuffer1_1[j]=EMPTY_VALUE;      if(ExtMapBuffer2[j]>ExtMapBuffer2[j+1]) ExtMapBuffer2_2[j]=ExtMapBuffer2[j]; else ExtMapBuffer2_2[j]=EMPTY_VALUE;      if(ExtMapBuffer3[j]>ExtMapBuffer3[j+1]) ExtMapBuffer3_3[j]=ExtMapBuffer3[j]; else ExtMapBuffer3_3[j]=EMPTY_VALUE;  }   return(0);  }//+------------------------------------------------------------------+

以上 mq4 long


一下 mq4 short

//+------------------------------------------------------------------+//|                  Guppy Mulitple Moving Average (Short double).mq4|//|                                                  candlexu@163.Com|//|                                                                  |//+------------------------------------------------------------------+#property copyright "2008 candlexu"#property indicator_chart_window//#property indicator_separate_window#property indicator_buffers 6#property indicator_color1 Yellow//Magenta#property indicator_color2 Magenta#property indicator_color3 Yellow#property indicator_color4 Magenta#property indicator_color5 Yellow#property indicator_color6 Magentaextern int short_3=  3;extern int short_5=  5;extern int short_8=  8;//---- buffersdouble ExtMapBuffer1[];double ExtMapBuffer1_1[];double ExtMapBuffer2[];double ExtMapBuffer2_2[];double ExtMapBuffer3[];double ExtMapBuffer3_3[];//+------------------------------------------------------------------+//| Custom indicator initialization function                         |//+------------------------------------------------------------------+int init()  {//---- indicators   SetIndexStyle(0,DRAW_LINE);   SetIndexBuffer(0,ExtMapBuffer1);   SetIndexStyle(1,DRAW_LINE);   SetIndexBuffer(1,ExtMapBuffer1_1);   SetIndexStyle(2,DRAW_LINE);   SetIndexBuffer(2,ExtMapBuffer2);   SetIndexStyle(3,DRAW_LINE);   SetIndexBuffer(3,ExtMapBuffer2_2);   SetIndexStyle(4,DRAW_LINE);   SetIndexBuffer(4,ExtMapBuffer3);   SetIndexStyle(5,DRAW_LINE);   SetIndexBuffer(5,ExtMapBuffer3_3);//----   return(0);  }int deinit()  {   return(0);  }int start()  {   int i,j,limit,counted_bars=IndicatorCounted();         if(counted_bars<0) return(-1);   if(counted_bars>0) counted_bars--;   limit=Bars-counted_bars;      for(i=0; i<limit; i++){      ExtMapBuffer1[i]=iMA(NULL,0,short_3,0,MODE_EMA,PRICE_CLOSE,i);      ExtMapBuffer2[i]=iMA(NULL,0,short_5,0,MODE_EMA,PRICE_CLOSE,i);      ExtMapBuffer3[i]=iMA(NULL,0,short_8,0,MODE_EMA,PRICE_CLOSE,i);   }  for(j = Bars-counted_bars-1;j>=0;j--)  {      if(ExtMapBuffer1[j]>ExtMapBuffer1[j+1]) ExtMapBuffer1_1[j]=ExtMapBuffer1[j]; else ExtMapBuffer1_1[j]=EMPTY_VALUE;      if(ExtMapBuffer2[j]>ExtMapBuffer2[j+1]) ExtMapBuffer2_2[j]=ExtMapBuffer2[j]; else ExtMapBuffer2_2[j]=EMPTY_VALUE;      if(ExtMapBuffer3[j]>ExtMapBuffer3[j+1]) ExtMapBuffer3_3[j]=ExtMapBuffer3[j]; else ExtMapBuffer3_3[j]=EMPTY_VALUE;  }   return(0);  }//+------------------------------------------------------------------+

//+------------------------------------------------------------------+//|                  Guppy Mulitple Moving Average (Short double).mq4|//|                                                  candlexu@163.Com|//|                                                                  |//+------------------------------------------------------------------+#property copyright "2008 candlexu"#property indicator_chart_window//#property indicator_separate_window#property indicator_buffers 6#property indicator_color1 Yellow//Magenta#property indicator_color2 Magenta#property indicator_color3 Yellow#property indicator_color4 Magenta#property indicator_color5 Yellow#property indicator_color6 Magentaextern int short_10=  10;extern int short_13=  13;extern int short_15=  15;//---- buffersdouble ExtMapBuffer1[];double ExtMapBuffer1_1[];double ExtMapBuffer2[];double ExtMapBuffer2_2[];double ExtMapBuffer3[];double ExtMapBuffer3_3[];//+------------------------------------------------------------------+//| Custom indicator initialization function                         |//+------------------------------------------------------------------+int init()  {//---- indicators   SetIndexStyle(0,DRAW_LINE);   SetIndexBuffer(0,ExtMapBuffer1);   SetIndexStyle(1,DRAW_LINE);   SetIndexBuffer(1,ExtMapBuffer1_1);   SetIndexStyle(2,DRAW_LINE);   SetIndexBuffer(2,ExtMapBuffer2);   SetIndexStyle(3,DRAW_LINE);   SetIndexBuffer(3,ExtMapBuffer2_2);   SetIndexStyle(4,DRAW_LINE);   SetIndexBuffer(4,ExtMapBuffer3);   SetIndexStyle(5,DRAW_LINE);   SetIndexBuffer(5,ExtMapBuffer3_3);//----   return(0);  }int deinit()  {   return(0);  }int start()  {   int i,j,limit,counted_bars=IndicatorCounted();         if(counted_bars<0) return(-1);   if(counted_bars>0) counted_bars--;   limit=Bars-counted_bars;      for(i=0; i<limit; i++){      ExtMapBuffer1[i]=iMA(NULL,0,short_10,0,MODE_EMA,PRICE_CLOSE,i);      ExtMapBuffer2[i]=iMA(NULL,0,short_13,0,MODE_EMA,PRICE_CLOSE,i);      ExtMapBuffer3[i]=iMA(NULL,0,short_15,0,MODE_EMA,PRICE_CLOSE,i);   }  for(j = Bars-counted_bars-1;j>=0;j--)  {      if(ExtMapBuffer1[j]>ExtMapBuffer1[j+1]) ExtMapBuffer1_1[j]=ExtMapBuffer1[j]; else ExtMapBuffer1_1[j]=EMPTY_VALUE;      if(ExtMapBuffer2[j]>ExtMapBuffer2[j+1]) ExtMapBuffer2_2[j]=ExtMapBuffer2[j]; else ExtMapBuffer2_2[j]=EMPTY_VALUE;      if(ExtMapBuffer3[j]>ExtMapBuffer3[j+1]) ExtMapBuffer3_3[j]=ExtMapBuffer3[j]; else ExtMapBuffer3_3[j]=EMPTY_VALUE;  }   return(0);  }//+------------------------------------------------------------------+


//+------------------------------------------------------------------+//|Writer: beyond.cheng  mail:thbird2000@sina.com   Custom jyjqr.mq4 |//|                      Copyright ?2004, MetaQuotes Software Corp. |//|                                       http://www.metaquotes.net/ |//+------------------------------------------------------------------+#property  copyright "Copyright ?2004, MetaQuotes Software Corp."#property  link      "http://www.metaquotes.net/"//---- indicator settings#property  indicator_chart_window#property  indicator_buffers 4#property  indicator_color1  White#property  indicator_color2  Yellow#property  indicator_color3  C'255,128,128'#property  indicator_color4  C'0,128,255'   //---- indicator parametersextern int FastEMA=7;extern int SlowEMA=21;//extern int SignalSMA=9;//---- indicator buffersdouble     ind_buffer1[];double     ind_buffer2[];double     ind_buffer3[];double     ind_buffer4[];double     temp;//+------------------------------------------------------------------+//| Custom indicator initialization function                         |//+------------------------------------------------------------------+int init()  {//---- drawing settings   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,1);   SetIndexStyle(1,DRAW_LINE,STYLE_SOLID,1);   SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,1);   SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,1);   SetIndexDrawBegin(1,FastEMA);   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+1);//---- indicator buffers mapping   if(!SetIndexBuffer(0,ind_buffer1) && !SetIndexBuffer(1,ind_buffer2)&& !SetIndexBuffer(2,ind_buffer3)&& !SetIndexBuffer(3,ind_buffer4))      Print("cannot set indicator buffers!");//---- name for DataWindow and indicator subwindow label   IndicatorShortName("JYJQR("+FastEMA+","+SlowEMA+")");//   SetIndexLabel(0,"MACD");   //SetIndexLabel(1,"Signal");//---- initialization done   return(0);  }//+------------------------------------------------------------------+//| Moving Averages Convergence/Divergence                           |//+------------------------------------------------------------------+int start()  {   int limit;   int counted_bars=IndicatorCounted();//---- check for possible errors   if(counted_bars<0) return(-1);//---- last counted bar will be recounted   if(counted_bars>0) counted_bars--;   limit=Bars-counted_bars;//---- macd counted in the 1-st buffer   for(int i=0; i<limit; i++)      ind_buffer1[i]=iMA(NULL,0,FastEMA,0,MODE_EMA,PRICE_CLOSE,i);//---- signal line counted in the 2-nd buffer   for(i=0; i<limit; i++)      ind_buffer2[i]=iMAOnArray(ind_buffer1,Bars,SlowEMA,0,MODE_EMA,i);         for(i=0; i<limit; i++)      {       temp=(ind_buffer1[i]-ind_buffer2[i]);       if(temp>0) {ind_buffer3[i]=ind_buffer2[i]+temp;ind_buffer4[i]=ind_buffer2[i];}       else       {ind_buffer3[i]=ind_buffer1[i];ind_buffer4[i]=ind_buffer2[i];}             }      //---- done   return(0);  }