DailyHighLow_v1

Author: RonT
DailyHighLow_v1
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
DailyHighLow_v1
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/


//+------------------------------------------------------------------+
//|                                               Daily High Low.mq4 |
//|                                           Copywrong 2005, RonT   |
//|                                 http://www.lightpatch.com/forex/ |
//+------------------------------------------------------------------+
#property copyright "RonT"
#property link      "http://www.lightpatch.com/forex/"

#property indicator_chart_window
#property indicator_buffers 2

double LOBuffer[];
double HIBuffer[];



//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }


//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
   SetIndexStyle(0,DRAW_LINE,0,1,DarkTurquoise);
   SetIndexBuffer(0,LOBuffer);

   SetIndexStyle(1,DRAW_LINE,0,1,Crimson);
   SetIndexBuffer(1,HIBuffer);

   return(0);
  }



//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()

  {
   int    counted_bars=IndicatorCounted();
   int    limit, i;

   double dayhigh=0;
   double daylow=999;
   
   if(counted_bars<0) return(-1);
   limit=(Bars-counted_bars)-1;

   for (i=limit; i>=0;i--)
     { 
      if (dayhigh<High[i]) {dayhigh=High[i];}
      if (daylow>Low[i])   {daylow=Low[i];  }

      if (TimeDay(Time[i])!=TimeDay(Time[i+1]))
        { 
         // reset limits when day changes
         dayhigh=High[i];
         daylow=Low[i];
        }
   
      LOBuffer[i]=daylow;
      HIBuffer[i]=dayhigh;

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