//+------------------------------------------------------------------ //| Custom Moving Average.mq5 | //| Copyright 2009, MetaQuotes Software Corp. | //| http://www.mql5.com | //+------------------------------------------------------------------ #property copyright "2009, MetaQuotes Software Corp." #property link "http://www.mql5.com" //--- 指标设置 #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 #property indicator_type1 DRAW_LINE #property indicator_color1 Red //--- 输入参数 input int InpMAPeriod=13; // 周期 input int InpMAShift=0; // 偏移 input ENUM_MA_METHOD InpMAMethod=MODE_SMMA; // 方式 //--- 指标缓存 double ExtLineBuffer[]; //+------------------------------------------------------------------ //| 简单移动平均 | //+------------------------------------------------------------------ void CalculateSimpleMA(int rates_total,int prev_calculated,int begin,const double &price[]) { int i,limit; //--- 第一次计算或者柱的数量有变化 if(prev_calculated==0)// 首次计算 { limit=InpMAPeriod+begin; //--- 首个limit个柱形设置为空 for(i=0;i