gold 发表于 2011-11-8 17:55:17

请牛版帮忙改成多周期的!

//+------------------------------------------------------------------+
//|                                                         T3MA.mq4 |
//|                                     Copyright ?2005, Nick Bilak |
//|                                        http://www.forex-tsd.com/ |
//|                              modified for VolumeFactor by: ben |
//|                                                thanks to Bilak |
//+------------------------------------------------------------------+
#property copyright \"Copyright ?2005, Nick Bilak\"
#property link      \"http://www.forex-tsd.com/\"

//---- indicator settings
#propertyindicator_chart_window
#propertyindicator_buffers 1
#propertyindicator_color1Lime
//---- indicator parameters
extern int Periods         = 8; //12
extern double VolumeFactor = 0.7; //0.8
//---- indicator buffers
double e1[];
double e2[];
double e3[];
double e4[];
double e5[];
double e6[];
double e7[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
    {
   IndicatorBuffers(7);
//---- drawing settings
   SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,12);
   SetIndexDrawBegin(0,Periods);
   if(
             !SetIndexBuffer(0,e7) &&
      !SetIndexBuffer(1,e2) &&
      !SetIndexBuffer(2,e3) &&
      !SetIndexBuffer(3,e4) &&
      !SetIndexBuffer(4,e5) &&
      !SetIndexBuffer(5,e6) &&
             !SetIndexBuffer(6,e1)
      )
      Print(\"cannot set indicator buffers!\");
//---- name for DataWindow and indicator subwindow label
   IndicatorShortName(\"T3MA(\"+Periods+\")\");
//---- initialization done
   return(0);
   
    }
//+------------------------------------------------------------------+
//| Moving Average of Oscillator                                     |
//+------------------------------------------------------------------+
int start()
    {
   int i,limit;
   int counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars0) counted_bars--;
   
   //limit=Bars-Periods-1-counted_bars;
   limit=Bars-counted_bars;
//---- main loop
   for(i=limit; i>=0; i--)
   {
             e1=iMA(NULL,0,Periods,0,MODE_EMA,PRICE_CLOSE,i);
   }
   for(i=limit; i>=0; i--)
   {
             e2=iMAOnArray(e1,0,Periods,0,MODE_EMA,i);
   }
   for(i=limit; i>=0; i--)
   {
             e3=iMAOnArray(e2,0,Periods,0,MODE_EMA,i);
   }
   for(i=limit; i>=0; i--)
   {
             e4=iMAOnArray(e3,0,Periods,0,MODE_EMA,i);
   }
   for(i=limit; i>=0; i--)
   {
             e5=iMAOnArray(e4,0,Periods,0,MODE_EMA,i);
   }
   
          double a= VolumeFactor; //0.8;
          double c1=-a*a*a;
          double c2=3*a*a+3*a*a*a;
          double c3=-6*a*a-3*a-3*a*a*a;
          double c4=1+3*a+a*a*a+3*a*a;
          //T3MA=c1*e6+c2*e5+c3*e4+c4*e3;
   for(i=limit; i>=0; i--)
   {
             e6=iMAOnArray(e5,0,Periods,0,MODE_EMA,i);
             e7=c1*e6+c2*e5+c3*e4+c4*e3;
   }
//---- done
   return(0);
    }
/*
e1:= Mov(Pr,tPr,mt);
e2:= Mov(e1,tPr,mt);
e3:= Mov(e2,tPr,mt);
e4:= Mov(e3,tPr,mt);
e5:= Mov(e4,tPr,mt);
e6:= Mov(e5,tPr,mt);
c1:= -b*b*b;
c2:= 3*b*b+3*b*b*b;
c3:= -6*b*b-3*b-3*b*b*b;
c4:= 1+3*b+b*b*b+3*b*b;
T3MA:= c1*e6+c2*e5+c3*e4+c4*e3;
*/
//+------------------------------------------------------------------+



请牛版帮忙改成多周期的谢谢.!

20121 发表于 2012-11-22 00:28:10

这个贴不错!!!!!

醉卧花丛 发表于 2012-11-22 00:28:10

鉴定完毕.!

hvbib 发表于 2012-11-22 00:28:10

好帖,有才

一杯白水 发表于 2012-11-22 00:28:10

小生对楼主之仰慕如滔滔江水连绵不绝,海枯石烂,天崩地裂,永不变心.

不要找他 发表于 2012-11-22 00:28:10

我的啦嘿嘿

衣冠禽兽 发表于 2012-11-22 00:28:10

我帮你 喝喝

问问 发表于 2012-11-22 00:28:10

现在越做月亏啊

性欲太强 发表于 2012-11-22 00:28:10

嘿嘿......哈哈......呵呵.....哟~呼

xiaodong 发表于 2012-11-22 00:28:10

我在顶贴~!~
页: [1] 2
查看完整版本: 请牛版帮忙改成多周期的!