爱也好恨也好百度云:[i★] 97 又一种均线写法 TEMA

来源:百度文库 编辑:偶看新闻 时间:2024/04/28 07:18:51

[i★] 97 又一种均线写法 TEMA_RLH  

2011-06-26 00:51:16|  分类: [ i ] 已过指标 |  标签: |字号大中小 订阅

 

 

//[i] 97 又一种均线写法 TEMA_RLH

/*
原形 TE均 = 3 * 首均 - 3 * (次滑均) + 再滑均
*/

#property  indicator_chart_window
#property  indicator_buffers 4
#property  indicator_color1  Red
#property  indicator_color2  Green
#property  indicator_color3  Yellow
#property  indicator_color4  Aqua
#property  indicator_width1  1
#property  indicator_width2  1
#property  indicator_width3  1
#property  indicator_width4  5

extern int 基本平滑周期 = 10;

double 首均[];
double 次滑均[];
double 再滑均[];
double TE均[];

//----------------初始化------------------+

int init()
  {
   SetIndexStyle(0,DRAW_LINE);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexStyle(3,DRAW_LINE);
   SetIndexDrawBegin(0,基本平滑周期);
   IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2);

   if(!SetIndexBuffer(0,首均) &&
      !SetIndexBuffer(1,次滑均) &&
      !SetIndexBuffer(2,再滑均) &&
      !SetIndexBuffer(3,TE均))
      Print("不能设置缓存!");
     
   IndicatorShortName("TE均("+基本平滑周期+")");
   return(0);
  }

//--------------主函数--------------------+

int start()
  {
   int i, 最少计;
   int 已计= IndicatorCounted();
   if(已计>0)
      已计--;
   最少计=Bars-已计;
 
   for(i=最少计; i>=0; i--)
      首均[i]=iMA(NULL,0,基本平滑周期,0,MODE_EMA,PRICE_CLOSE,i);
   for(i=最少计; i >=0; i--)
      次滑均[i]=iMAOnArray(首均,Bars,基本平滑周期,0,MODE_EMA,i);
 
   for(i=最少计; i >=0; i--)
      再滑均[i]=iMAOnArray(次滑均,Bars,基本平滑周期,0,MODE_EMA,i);
     
   //            
   for(i=最少计; i >=0; i--)
      TE均[i]= 再滑均[i] + (首均[i]-次滑均[i])*3;
      //TE均[i]= 首均[i] + (次滑均[i]-再滑均[i])*1.5;
   return(0);
  }
 
//+------------------------------------------------------------------+