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

MT4自定义指标大智慧BRAR



情绪指标(ARBR)也称为人气意愿指标,其英文缩写亦可表示为BRAR。由人气指标(AR)和意愿指标(BR)两个指标构成。AR指标和BR指标都是以分析历史股价为手段的技术指标。

大智慧BRAR图表效果如下:大智慧BRAR指标

大智慧BRAR指标MQL4源码如下:

//+------------------------------------------------------------------+
//|                                                Dazhihui_BRAR.mq4 |
//|                                       Copyright @2013, 125808047 |
//+------------------------------------------------------------------+
#property copyright "www.125808047.com"
#property link      "http://www.125808047.com"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Lime
#property indicator_color2 Fuchsia
#property indicator_level1 50.0
#property indicator_level2 70.0
#property indicator_level3 150.0
#property indicator_level4 400.0

extern string ExpertName = "峰汇在线";
extern int BRARperiod = 26;
double g_ibuf_88[];
double g_ibuf_92[];

int init() {
   IndicatorBuffers(2);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexBuffer(0, g_ibuf_88);
   SetIndexStyle(1, DRAW_LINE, STYLE_DOT);
   SetIndexBuffer(1, g_ibuf_92);
   IndicatorShortName("BRAR(" + BRARperiod + ")");
   return (0);
}

int deinit() {
   return (0);
}

int start() {
   double ld_0;
   double ld_8;
   double ld_16;
   double ld_24;
   int li_40 = IndicatorCounted();
   if (li_40 < 0) return (-1);
   if (li_40 > 0) li_40--;
   int li_32 = Bars - BRARperiod + 1;
   if (li_40 > BRARperiod - 1) li_32 = Bars - li_40 - 1;
   while (li_32 >= 0) {
      ld_0 = 0;
      ld_8 = 0;
      ld_24 = 0;
      ld_16 = 0;
      for (int li_36 = li_32 + BRARperiod - 1; li_36 >= li_32; li_36--) {
         ld_0 += MathMax(0, High[li_36] - (Close[li_36 + 1]));
         ld_8 += MathMax(0, Close[li_36 + 1] - Low[li_36]);
         ld_16 += MathMax(0, High[li_36] - Open[li_36]);
         ld_24 += MathMax(0, Open[li_36] - Low[li_36]);
      }
      g_ibuf_88[li_32] = 100.0 * ld_0 / ld_8;
      g_ibuf_92[li_32] = 100.0 * ld_16 / ld_24;
      li_32--;
   }
   return (0);
}
如您喜欢此文章请点下面分享按钮↴峰汇在线 » MT4自定义指标大智慧BRAR
上一篇:
下一篇:
分享到:更多 ()