有您的持续关注
我们会做得更好

MT4自定义指标MrBean



MrBean指标以通道的形式呈现。

图表效果如下:

MrBean指标MrBean指标源码如下:

//+------------------------------------------------------------------+
//|                                                       MrBean.mq4 |
//|                                     Copyright 2014, QQ:125808047 |
//+------------------------------------------------------------------+
#property copyright "www.125808047.com"
#property link      "http://www.125808047.com/"

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DarkSalmon
#property indicator_color2 CornflowerBlue
//---- input parameters
extern int       ExtParam1=20;
extern int       ExtParam2=20;
extern int       PriceMode=0;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexDrawBegin(1,ExtParam1);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexDrawBegin(1,ExtParam2);
   SetIndexBuffer(1,ExtMapBuffer2);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//---- TODO: add your code here
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
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;
//---- 
   for(int i=0; i<limit; i++)
      //ExtMapBuffer1[i]=iMA(NULL,0,ExtParam1,MODE_EMA,0,PRICE_CLOSE,i);
      {
      if(PriceMode == 0) ExtMapBuffer1[i]=Close[iLowest(NULL,0,MODE_CLOSE,ExtParam1,i)];
      if(PriceMode == 1) ExtMapBuffer1[i]=Low[iLowest(NULL,0,MODE_LOW,ExtParam1,i)];
      }
//---- 
   for(i=0; i<limit; i++)
      {
      if(PriceMode == 0) ExtMapBuffer2[i]=Close[iHighest(NULL,0,MODE_CLOSE,ExtParam2,i)];
      if(PriceMode == 1) ExtMapBuffer2[i]=High[iHighest(NULL,0,MODE_HIGH,ExtParam2,i)];
      }
//---- done
   return(0);
  }
//+------------------------------------------------------------------+

如您喜欢此文章请点下面分享按钮↴峰汇在线 » MT4自定义指标MrBean
上一篇:
下一篇:
分享到:更多 ()