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

瀑布线指标



计算几根均线的和及平均值而绘制的均线组,有兴趣的可以总结用法或根据源码扩展。

插入MT4图表效果如下:MT4瀑布线指标MQL4源码如下:

//+------------------------------------------------------------------+
//|                                                       瀑布线.mq4 |
//|                                     Copyright 2016, QQ:125808047 |
//+------------------------------------------------------------------+
#property copyright "www.125808047.com"
#property link      "http://www.125808047.com/"
#property indicator_chart_window
#property indicator_buffers 6
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Lime
#property indicator_color4 Red
#property indicator_color5 Lime
#property indicator_color6 Red

double mac_1[];
double mac_2[];
double mac_3[];
double mac_4[];
double mac_5[];
double mac_6[];

int init() {
   IndicatorBuffers(6);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexStyle(4, DRAW_LINE);
   SetIndexStyle(5, DRAW_LINE);
   SetIndexBuffer(0, mac_1);
   SetIndexBuffer(1, mac_2);
   SetIndexBuffer(2, mac_3);
   SetIndexBuffer(3, mac_4);
   SetIndexBuffer(4, mac_5);
   SetIndexBuffer(5, mac_6);
   return (0);
}

int start() {
   int li_8 = IndicatorCounted();
   if (li_8 < 0) return (-1); if (li_8 > 0) li_8--;
   int li_4 = Bars - li_8;
   for (int li_0 = li_4 - 1; li_0 >= 0; li_0--) {
      mac_1[li_0] = (iMA(NULL, 0, 4, 0, MODE_EMA, PRICE_CLOSE, li_0) + iMA(NULL, 0, 8, 0, MODE_SMA, PRICE_CLOSE, 
li_0) + iMA(NULL, 0, 16, 0, MODE_SMA, PRICE_CLOSE,
         li_0)) / 3.0;
      mac_2[li_0] = (iMA(NULL, 0, 6, 0, MODE_EMA, PRICE_CLOSE, li_0) + iMA(NULL, 0, 12, 0, MODE_SMA, PRICE_CLOSE, 
li_0) + iMA(NULL, 0, 24, 0, MODE_SMA, PRICE_CLOSE,
         li_0)) / 3.0;
      mac_3[li_0] = (iMA(NULL, 0, 9, 0, MODE_EMA, PRICE_CLOSE, li_0) + iMA(NULL, 0, 18, 0, MODE_SMA, PRICE_CLOSE,
 li_0) + iMA(NULL, 0, 36, 0, MODE_SMA, PRICE_CLOSE,
         li_0)) / 3.0;
      mac_4[li_0] = (iMA(NULL, 0, 13, 0, MODE_EMA, PRICE_CLOSE, li_0) + iMA(NULL, 0, 26, 0, MODE_SMA, PRICE_CLOSE, li_0) + iMA(NULL, 0, 52, 0, MODE_SMA, PRICE_CLOSE,
         li_0)) / 3.0;
      mac_5[li_0] = (iMA(NULL, 0, 18, 0, MODE_EMA, PRICE_CLOSE, li_0) + iMA(NULL, 0, 36, 0, MODE_SMA, PRICE_CLOSE, li_0) + iMA(NULL, 0, 72, 0, MODE_SMA, PRICE_CLOSE,
         li_0)) / 3.0;
      mac_6[li_0] = (iMA(NULL, 0, 24, 0, MODE_EMA, PRICE_CLOSE, li_0) + iMA(NULL, 0, 48, 0, MODE_SMA, PRICE_CLOSE, li_0) + iMA(NULL, 0, 96, 0, MODE_SMA, PRICE_CLOSE,
         li_0)) / 3.0;
   }
   return (0);
}

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