# Question about iHighest when the range to count is 0

158

Hi everyone,

First time working with iHighest.

When the number of bars to count is == 0, iHighest counts the whole array.

However, in certain situations, the candle with the highest value is the same candle from which to start counting.

As you can see, this is a problem.

As a result, I've added the highlighted part to make sure that the range of candles to count will always be at least 1.

My question is: will adding +1 to the range of candles to count skew the results of always grabbing the highest value between the range I want to search through? I was wondering if I should stick with this or just add an if statement that makes 'maeShift' = 1 if x-i is equal to 0.

`int maeShift = iHighest(Symbol(),PERIOD_H1,MODE_HIGH,(x-i)+1,i);`

In case you're wondering what the variables x and i are:

x = H1 Sunday Gap Open Candle

i = H1 Sunday Gap Fill Candle

16086

 user3822: When the number of bars to count is == 0, iHighest counts the whole array.However, in certain situations, the candle with the highest value is the same candle from which to start counting. As you can see, this is a problem.As a result, I've added the highlighted part to make sure that the range of candles to count will always be at least 1. iHighest has nothing to do with arrays (documentation translation should say chart.) For arrays, use ArrayMaximum - Array Functions - MQL4 ReferenceWhy is that a problem - there are no mind readers here. From [a .. b] (inclusive) there are a-b+1 always.`iHighest(Symbol(),PERIOD_H1,MODE_HIGH,x-i+1,i);`This only works on the H1 chart. Don't hard code
158

whroeder1:
 iHighest has nothing to do with arrays (documentation translation should say chart.) For arrays, use ArrayMaximum - Array Functions - MQL4 ReferenceWhy is that a problem - there are no mind readers here. From [a .. b] (inclusive) there are a-b+1 always.This only works on the H1 chart. Don't hard code
I'm not using an array. x is a variable representing a Sunday Gap Open. i is a variable representing a Sunday Gap Fill. What's not clear?
16086

 user3822: I'm not using an array. x is a variable representing a Sunday Gap Open. i is a variable representing a Sunday Gap Fill. What's not clear? is == 0, iHighest counts the whole array.That's not what you initially implied.Whatever "Sunday Gap Open" meansWhatever "Sunday Gap Fill" meansWhat your problem is.