English

## Find the highest / lowest of CLOSE price of some bars

 6 pedma 2015.02.05 07:06   Hi,We can get highest / lowest value of last Depth bar using (similar to MT4 Zigzag indicator) :  ```double theHighest = high[iHighest(NULL,0,MODE_HIGH,Depth,i)]; double theLowest  = low[iLowest(NULL,0,MODE_LOW,Depth,i)];```But how can we get the highest/lowest of the CLOSE price of each bar in the last Depth bars ?  Which one from the code below is the right one ?```double theHighest = close[iHighest(NULL,0,MODE_CLOSE,Depth,i)]; double theLowest = close[iLowest(NULL,0,MODE_CLOSE,Depth,i)]; ** OR ** double theHighest = high[iHighest(NULL,0,MODE_CLOSE,Depth,i)]; double theLowest = low[iLowest(NULL,0,MODE_CLOSE,Depth,i)]; ```Thank you in advance.
 2033 gooly 2015.02.05 09:03 #   the first two lines:```double theHighest = close[iHighest(NULL,0,MODE_CLOSE,Depth,i)]; // <= close of the bar found double theLowest = close[iLowest(NULL,0,MODE_CLOSE,Depth,i)]; ```But instead of waiting for 2 hours or more why don't you write a simple script to check it out yourself?That would take 5 min to get the result instead of 2 hours?
 Moderator3517 GumRai 2015.02.05 12:04 #   As Gooly says, but bear in mind that by using close, it is unclear from the documentation whether the default is set as series or notSo you should include`ArraySetAsSeries(close,true);` Before your code. Otherwise just use Open instead of open
 16 gviali 2015.02.06 04:38 #   Taking advantage of this topic, I had a doubt earlier..If I wish to spot some divergence with bollinger bands.. can it be done using this code? ```double theHighest = Close[iHighest(NULL,0,MODE_CLOSE,Depth,i)]; //count the close for the past Depth bars double theHighestPast = Close[iHighest(NULL,0,MODE_CLOSE,Depth,i+Depth)]; //count the close for the past Depth bars before theHighest double BB = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,"how to specify that this is to count the last 'Depth' bars"); double BBPast = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,"how to specify that this is to count the 'Depth' previous than the last Depth bars"); if(theHighestPast>BBpast /* if closed out of the bands at some point between this time*/ && theHighest<=BB && theHighest>theHighestPast /*the last highest was higher than the previous and didnt close out of the bollinger bands*/) ``` I've checked to use the iBarShift() function, but not shure how it would fit in this..