求助非线性加权移动平均线指标

 
(EXPMA(CLOSE,n)+MA(CLOSE,n*2)+MA(CLOSE,n*4))/3

请帮忙编成MT4指标
 

Here you are


//+------------------------------------------------------------------+
//|                                                  zsh226expMA.mq4 |
//|                      Copyright © 2008, MetaQuotes Software Corp. |
//|                                   https://forum.mql4.com/cn/17189 |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, MetaQuotes Software Corp."
#property link      "https://forum.mql4.com/cn/17189"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Red
//---- input parameters
extern int       Period_n=10;
//---- buffers
double ExtMapBuffer1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
   int  limit,  counted_bars=IndicatorCounted();
   if (counted_bars>0) limit = Bars - counted_bars;
   if (counted_bars==0) limit = Bars - Period_n*4;
   
//----
   for (int i = limit; i>=0; i--)
      {
      ExtMapBuffer1[i] = (iMA(Symbol(),0,Period_n,0,MODE_EMA,PRICE_CLOSE,i) + 
         iMA(Symbol(),0,Period_n*2,0,MODE_SMA,PRICE_CLOSE,i) +
         iMA(Symbol(),0,Period_n*4,0,MODE_SMA,PRICE_CLOSE,i))/3.0; 
      }
//----
   return(0);
  }
//+------------------------------------------------------------------+



附加的文件:
 
谢谢
 
Rosh 写道 >>

Here you aRE

ROSH 好热心,请问一下代码如何改写?多谢。

BIAS1:=(MA(C,2)-MA(C,4))/MA(C,4)*100;

BIAS2:=(MA(C,2)-MA(C,8))/MA(C,8)*100;

BIAS3:=(MA(C,2)-MA(C,12))/MA(C,12)*100;

BIAS:MA((BIAS1+2*BIAS2+5*BIAS3)/8,5)*50,colorred;

biass:MA(BIAS,2),colorgreen;

0,colorred;

原因: