identify Highest close of last 10 candles then store to variable
-
I need help to:
- Identify the highest close of last 10 candles
- starting at Candle id 1
- then store in variable.
Thank you for helping.
VanceDavid
-
@vancedavid there is a direct mql function for that: https://www.mql5.com/en/docs/series/ihighest
Your case (put this in custom mql block):
somevariable = iHighest(NULL, 0, 10, 1);
-
Thank you roar.
I will research this solution (direct mql function) . I have never attempted custom mql block so we shall see how things work out.
Thank you roar. I truly appreciate the help.
VanceDavid
-
@roar
You said in identify Highest close of last 10 candles then store to variable:there is a direct mql function for that: https://www.mql5.com/en/docs/series/ihighest
Your case (put this in custom mql block):
somevariable = iHighest(NULL, 0, 10, 1);Pictures of Charts – Idea’s
Identify Highest Close of Last 10 Candles
Hi Roar,
The Problem
Identify the highest close of last 10 candles
starting at Candle id 1
then store in variable.You suggested that there is a direct mql function for that: https://www.mql5.com/en/docs/series/ihighest
Your case (put this in custom mql block):
somevariable = iHighest(NULL, 0, 10, 1);
Shared Project for Testing- https://fxdreema.com/shared/K62Z6eXkb

I have been attempting to incorporate your suggestion however when testing I do not get the Highest close
The comment test suggest it is simply counting which bar I am on and rotating through bar 1 to 10
Any idea’s how we can fix this.
Note: In fxDreema I created the variable HighestClose.
When I create the custom MQL code I cannot seem to add the fxDreema variable so I
Typed in the variable in ---
HighestClose = iHighest(NULL,0,MODE_CLOSE,10,1);I simple don’t know.
-
@vancedavid under the conditions block, select market properties, and then you can look at the highest or lowest # of candles or time that you specify in there. a lot simpler than a code I think.
-
@vancedavid yeah sorry, the function doesnt actually return a price value, it returns the index of the highest candle.

So you have to do 1 more step.
somevariable = iHighest(NULL, 0, 10, 1);
highestclose = iHigh(NULL, 0, somevariable ); -
@jsauter86
Thank You jsauter86.
You are right about highest price in Market properties. Unfortunately I really wanted the highest close of the last 10 candles (x Candles).
Market properties does not seem to allow for the highest Close only the highest price.
Thank you for your helpful and good suggestion.
VanceDavid
-
Thank Your Roar. Problem Solved.
I was thinking. How could I create a custom block so that I could select Highest High easily and simply change the number of bars to calculate on.
Would this even be a worthwhile endeavor. It most certainly would be a good learning or teaching endeavor.
Thanks again roar.
VanceDavid
-
@vancedavid said in identify Highest close of last 10 candles then store to variable:
I was thinking. How could I create a custom block so that I could select Highest High easily and simply change the number of bars to calculate on.

These two numbers decide the starting bar and ending bar. You can replace them with a constant or variable