Author: Copyright � 2005, tageiger aka fxid10t@yahoo.com
Price Data Components
Series array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains open prices of each barSeries array that contains open time of each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
AvgRangeM
//+------------------------------------------------------------------+
//|    AvgRangeM                                        AvgRange.mq4 |
//|                 Copyright © 2005, tageiger aka fxid10t@yahoo.com |
//| /www.forex-tsd.com                     http://www.metatrader.org |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, tageiger aka fxid10t@yahoo.com"
#property link    "http://www.metatrader.org http://www.forex-tsd.com"
//----
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Yellow
#property indicator_color2 SpringGreen
#property indicator_color3 Tomato
#property indicator_style1 2
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double rng,sum.rng,avg.rng;
double rng1,sum.rng1,avg.rng1;
double rng2,sum.rng2,avg.rng2;
double rng3,sum.rng3,avg.rng3;
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
  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);}
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
  int deinit()   {return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
  int start()
  {
   int    counted_bars=IndicatorCounted();
   rng=0;sum.rng=0;avg.rng=0;
   rng1=0;sum.rng1=0;avg.rng1=0;
   rng2=0;sum.rng2=0;avg.rng2=0;
   rng3=0;sum.rng3=0;avg.rng3=0;
  
   for(int i=0;i<Bars;i++)
     {
      rng=(iHigh(Symbol(),Period(),i)-iLow(Symbol(),Period(),i));
      sum.rng+=rng;
      rng1=(iHigh(Symbol(),60,i)-iLow(Symbol(),60,i));
      sum.rng1+=rng1;
      rng2=(iHigh(Symbol(),240,i)-iLow(Symbol(),240,i));
      sum.rng2+=rng2;
       rng3=(iHigh(Symbol(),1440,i)-iLow(Symbol(),1440,i));
      sum.rng3+=rng3;

     }
   int db=iBars(Symbol(),Period());
   avg.rng=sum.rng/db;
   int db1=iBars(Symbol(),60);
   avg.rng1=sum.rng1/db1;
   int db2=iBars(Symbol(),240);
   avg.rng2=sum.rng2/db2;
   int db3=iBars(Symbol(),1440);
   avg.rng3=sum.rng3/db3;
  
   //----
   for(int s=0;s<Bars;s++)
     {
 
      ExtMapBuffer1[s]=(iOpen(Symbol(),Period(),s));
     ExtMapBuffer2[s]=(iOpen(Symbol(),Period(),s)+(avg.rng/2));
      ExtMapBuffer3[s]=(iOpen(Symbol(),Period(),s)-(avg.rng/2));
     }
   Comment("Last Tick: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS),"\n",
  //         "Sum of Period Ranges:",sum.rng,"\n",
 //          "Average Range:",avg.rng,"\n",
           "D1", " Average Range: ",avg.rng3,"\n",
           "H4", " Avgrage Range: ",avg.rng2,"\n",
           "H1", " Average Range: ",avg.rng1," \n",
           "TF", Period()," Average Range: ",avg.rng," ");
        
         
//           "Total Bars:",i+1  );
   return(0);
  }
//+------------------------------------------------------------------+

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---