HML_Minute5

Author: Copyright � 2010, Investors Haven
Price Data Components
Series array that contains the highest prices of each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each barSeries array that contains the lowest prices of each bar
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
HML_Minute5
//+------------------------------------------------------------------+
//|                                                  HML_Minute5.mq4 |
//|                                Copyright © 2010, Investors Haven |
//|                                    http://www.InvestorsHaven.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, Investors Haven"
#property link      "http://www.InvestorsHaven.com"

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 MediumTurquoise            // Sets the colors of the first
#property indicator_color2 MediumTurquoise            // 8 lines of the 24 line set
#property indicator_color3 MediumTurquoise
#property indicator_width1 3           // Sets the width of the lins in pixels
#property indicator_width2 3
#property indicator_width3 3


int BandsPeriod = 20;                        // sets an initial amount on the
//---- buffers                               // lines prior to displaying them
double M5High[];                          // Array buffer for M5s High
double M5Median[];                        // Array buffer for M5s median
double M5Low[];                           // Array buffer for M5s Low
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   SetIndexStyle(0,DRAW_LINE);         // Section draws the lines for each
   SetIndexBuffer(0,M5High);
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,M5Median);
   SetIndexStyle(2,DRAW_LINE);
   SetIndexBuffer(2,M5Low);

   
   SetIndexDrawBegin(0,BandsPeriod);      // Sets the lines starting point
   SetIndexDrawBegin(1,BandsPeriod);
   SetIndexDrawBegin(2,BandsPeriod);
   
   SetIndexLabel(0,"M5 High");         // Label the lines for easy reading
   SetIndexLabel(1,"M5 Median");
   SetIndexLabel(2,"M5 Low");
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
//----
   if(Bars<=BandsPeriod) return(0);     // exit if we don't have enough bars
   
   int    i,counted_bars=IndicatorCounted();   // Init variables
   
   //---- initial zero
   if(counted_bars<1)                        // No bars have been counted
   {
      for(i=1;i<=BandsPeriod;i++)            // Loop through assigning
        {                                    // all lines to empty
            M5High[Bars-i]=EMPTY_VALUE;   // so lines are  clean
            M5Median[Bars-i]=EMPTY_VALUE; 
            M5Low[Bars-i]=EMPTY_VALUE;
        }
     }
     
   int limit=Bars-counted_bars;              // determine our limit
   if(counted_bars>0) limit++;               // Track our limit as we count
   for(i=0; i<limit; i++)                    // Now loop through and assign
   {                                         // price values to lines via buffers
      M5High[i]= iHigh(NULL,PERIOD_M5,0);// get high for M5
      M5Median[i]= (((iHigh(NULL,PERIOD_M5,0) - iLow(NULL,PERIOD_M5,0))/2) + iLow(NULL,PERIOD_M5,0));
      M5Low[i]= iLow(NULL,PERIOD_M5,0);  // get low for PERIOD_PERIOD_PERIOD_M5
  }

   
//----
   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 ---