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

指标 Avg Daily Range



Avg Daily Range指标注意用在D1图表。图表效果:Avg Daily Range指标Avg Daily Range指标源码:

//+------------------------------------------------------------------+
//|                                              Avg Daily Range.mq4 |
//|                  Copyright @2005, tageiger aka fxid10t@yahoo.com |
//|                                        http://www.metatrader.org |
//+------------------------------------------------------------------+
#property copyright "Copyright @2005, tageiger aka fxid10t@yahoo.com"
#property link      "http://www.metatrader.org"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 SpringGreen
#property indicator_color3 Tomato
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

double rng,sum_rng,avg_rng;

int init()  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,ExtMapBuffer1);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,ExtMapBuffer2);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,ExtMapBuffer3);
//----
return(0);}

void deinit() {
   Comment("www.125808047.com");
}

int start() {
   int    counted_bars=IndicatorCounted();
   rng=0;sum_rng=0;avg_rng=0;
   
   for(int i=0;i<Bars;i++) {
      rng=(iHigh(Symbol(),PERIOD_D1,i)-iLow(Symbol(),PERIOD_D1,i));
      sum_rng+=rng;
   }

   int db=iBars(Symbol(),1440);   
   avg_rng=sum_rng/db;   

//   for(int t=0;t<db;t++)   {
      for(int s=0;s<Bars;s++) {

      ExtMapBuffer2[s]=(iOpen(Symbol(),PERIOD_D1,s)+(avg_rng/2));
      ExtMapBuffer3[s]=(iOpen(Symbol(),PERIOD_D1,s)-(avg_rng/2));
   }//  }
   Comment("Last Tick: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),"\n",
           "Sum of Daily Ranges:",sum_rng,"\n",
           "Average Range:",avg_rng,"\n",
           "i:",i+1);




return(0);}
//+------------------------------------------------------------------+

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