Download MetaTrader 5
To add comments, please log in or register
Add our Facebook page to friends. Follow the latest news!
Sven Hohmann
120
Sven Hohmann 2014.11.20 18:13 

Hello,

my problem is, that the iHigh function works fine for the horizontol line, but if i try to use the iHighest function it dont works, what is my fault?

#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Orange
#property indicator_color2 Orange

//External variables
extern double Sessionstart = 3;
extern double Sessionend = 7;


//Buffers
double Rangehigh[];
double Rangelow[];


//Init
int init()
   {
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,Rangehigh);
   SetIndexLabel(0,"Rangehigh");
   
   SetIndexStyle(1,DRAW_LINE);
   SetIndexBuffer(1,Rangelow);
   SetIndexLabel(1,"Rangelow");
   

   
   return(0);
   }
   
   //Start
   int start()
      {
       
         
         int CalculateBars = 240;
         
         for(int Count = CalculateBars; Count >= 0; Count--)
            {
              Rangehigh[Count] = iHighest(NULL,PERIOD_H1,MODE_HIGH,30,1);
                           
              Rangelow[Count] = iLow(NULL,PERIOD_H1,0);
            
   
             }
             
           return(0);
       }
   

Carl Schreiber
5965
Carl Schreiber 2014.11.20 19:30  

Don't mix up iHigh (=high of a bar) and iHighest (array index (shift) of the highest high of ...

Same with low!

Sven Hohmann
120
Sven Hohmann 2014.11.20 19:36  
gooly:

Don't mix up iHigh (=high of a bar) and iHighest (array index (shift) of the highest high of ...

Same with low!

I know what they do, my proble is that iHighest dont works in this indicator, on the chart is nothing. Just the iHigh Function works (or iLow)
Keith Watford
Moderator
8016
Keith Watford 2014.11.20 21:07  
Fx90:
I know what they do, my proble is that iHighest dont works in this indicator, on the chart is nothing. Just the iHigh Function works (or iLow)

You obviously don't know what they do!

iHighest does not return the high of a range, as gooly has already told you. 

Sven Hohmann
120
Sven Hohmann 2014.11.21 14:28  

thx now i understand what ya saying. I think i have worked too much with excel. it was my memory that this function would do this. in Excel it is the function "Max(defer area)". I wanted to defer the start of the period and then draw the line for a specific period lenth.

nice weekend

whroeder1
13653
whroeder1 2014.11.21 14:28  
GumRai: You obviously don't know what they do!
Fx90: you obviously don't.
Rangehigh[Count] = iHighest(NULL,PERIOD_H1,MODE_HIGH,30,1); = 15.00000
                           
Rangelow[Count] = iLow(NULL,PERIOD_H1,0);                   =  1.12345

Now look at the example from iLowest - MQL4 Documentation (iHighest has a pair of typos)
  double val;
//--- calculating the lowest value on the 10 consequtive bars in the range
//--- from the 10th to the 19th index inclusive on the current chart
   int val_index=iLowest(NULL,0,MODE_LOW,10,10);
   if(val_index!=-1) val=Low[val_index];
Sven Hohmann
120
Sven Hohmann 2014.11.21 18:27  
WHRoeder:
GumRai: You obviously don't know what they do!
Fx90: you obviously don't.
Now look at the example from iLowest - MQL4 Documentation (iHighest has a pair of typos)
Sorry my english isnt the best at all.. It means, that you search with iHighest the (int) number of the candle, which is the lowest of the last 10 periods? and with the iHigh function you search for the (double) low?
Carl Schreiber
5965
Carl Schreiber 2014.11.21 19:06  

possible way of usage:

double hiHi = iHigh(NULL,0, iHighest(NULL,0, ..));

it's all in the reference!

/
To add comments, please log in or register