HiLoXTF
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
HiLoXTF
//+------------------------------------------------------------------------+
//| This indicator was originaly called the HiLoH4.mq4 created by Rob Judd                                                         
//| to show the last four hours' Hi and Lo on the chart. THANK YOU ROB !!
//|
//| Accrete hacked the code to ad the Median line and also the ability
//| to change the look back time to include a user variable in the pop up
//| dialog box for breakout trading on 1 hour or more boxes.
//| File can be found at Accrete.com in indicator section with kudos
//| mentioned to Rob for original code. Renamed : ATM_HiLoXTF.mq4 by Accrete
//+------------------------------------------------------------------------+


#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Blue
#property indicator_color2 Purple
#property indicator_color3 Red


//---- input parameters
extern int HL_Hours = 4; //4 = 4 hours 
extern bool show_comment=true;
extern bool show_average=true;

//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];

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

int deinit()
{
   return(0);
}

int start()
{
   int count, cur_hour, prev_hour = 0;
   double hour_high, hour_low, H, L, A = 0;

   if (Period() >= PERIOD_D1)
      return(0);
   
   for (count=Bars;count>=0;count--) {

      cur_hour = TimeHour(Time[count]);

      if (prev_hour != cur_hour) {

         prev_hour = cur_hour;


if (!MathMod(cur_hour,HL_Hours)) {
         
            H = hour_high;
            A = (hour_high+hour_low)*0.5;
            L = hour_low;
            

            hour_high = High[count];
            hour_low = Low[count];
         }
      }

      hour_high = MathMax(hour_high, High[count]);
      hour_low = MathMin(hour_low, Low[count]);

      ExtMapBuffer1[count] = H;
      if (show_average)
         ExtMapBuffer2[count] = A;
      ExtMapBuffer3[count] = L;
   }

   if (show_comment)
            Comment("",HL_Hours, " Hour Hi=", H, ", Lo=", L, ", Range=", (H-L)/Point, " pips" );


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