Hi All,
I want to learn coding in MQL4 but cannot find a way to get Yesterday Highest CLOSED and Yesterday Lowest CLOSED price? I can get yesterday highest and Lowest price but not its closed price. Can anyone show me how to do it? Thanks in advance.
Do you mean the candle (which timeframe ?) which closed the lowest/highest yesterday - OR - the highest/lowest price of yesterday once market closed or the close price of the candle in which occured yesterday's highest/lowest ?
You're confuse.
Hi All,
I want to learn coding in MQL4 but cannot find a way to get Yesterday Highest CLOSED and Yesterday Lowest CLOSED price? I can get yesterday highest and Lowest price but not its closed price. Can anyone show me how to do it? Thanks in advance.
Maybe you should start reading in the editor's reference (F1) about Close[] and iClose().
It's a lot faster than waiting here for someone to answer.
Beside that you can be sure that practically all question you'll have the next week already have been asked and answered here: Search first by the lens top right on the pages!
Do you mean the candle (which timeframe ?) which closed the lowest/highest yesterday - OR - the highest/lowest price of yesterday once market closed or the close price of the candle in which occured yesterday's highest/lowest ?
You're
Do you mean the candle (which timeframe ?) which closed the lowest/highest yesterday - OR - the highest/lowest price of yesterday once market closed or the close price of the candle in which occured yesterday's highest/lowest ?
You're confuse.
WOW Icham! I don't realize so many different values...
Actually what I want is the price at yesterday Highest candle (body) and yesterday Lowest candle (body) in H1 time frame. Please see the attached picture. Thanks.
What you're looking for is yesterday open and close price :) - you want the highest & lowest from open&close price of 1h candles yesterday ?
According to his diagram he wants the highest close price in the working timeframe.
int start = iBarShift(_Symbol,_Period,iTime(_Symbol,PERIOD_D1,1)); int end = iBarShift(_Symbol,_Period,iTime(_Symbol,PERIOD_D1,1)+PeriodSeconds(PERIOD_D1)-1); double highest_close = Close[iHighest(_Symbol,_Period,MODE_CLOSE,start-end+1,end)];
void OpenCloseHighestLowestYesterday() { datetime yesterday[]; double open[], close[]; CopyTime(_Symbol,PERIOD_D1,1,1,yesterday); // CopyOpen(_Symbol,PERIOD_H1,yesterday[0],24,open); CopyClose(_Symbol,PERIOD_H1,yesterday[0],24,close); // double Lowest = MathMin(open[ArrayMinimum(open,WHOLE_ARRAY,0)],close[ArrayMinimum(close,WHOLE_ARRAY,0)]); double Highest = MathMax(open[ArrayMaximum(open,WHOLE_ARRAY,0)],close[ArrayMaximum(close,WHOLE_ARRAY,0)]); printf("*** Lowest H1 candle open/close yesterday : %g ---- Highest H1 candle open/close yesterday : %g",Lowest,Highest); }
This function for MQL4, will print the highest open or close price of all H1 candle yesterday and the lowest open or close price all H1 candle yesterday.
EDIT : I've corrected the code to suits MQL4 (ArrayMax & ArrayMin works differently)
According to his diagram he wants the highest close price in the working timeframe.
Not sure what he's really looking for, but here's what I got from his request :/
This function for MQL4, will print the highest open or close price of all H1 candle yesterday and the lowest open or close price all H1 candle yesterday.
EDIT : I've corrected the code to suits MQL4 (ArrayMax & ArrayMin works differently)
Not sure what he's really looking for, but here's what I got from his request :/
Thanks Icham. That is what I am looking for. I will try to see the results. Thanks again.
You welcome.
This function for MQL4, will print the highest open or close price of all H1 candle yesterday and the lowest open or close price all H1 candle yesterday.
EDIT : I've corrected the code to suits MQL4 (ArrayMax & ArrayMin works differently)
Not sure what he's really looking for, but here's what I got from his request :/

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi All,
I want to learn coding in MQL4 but cannot find a way to get Yesterday Highest CLOSED and Yesterday Lowest CLOSED price? I can get yesterday highest and Lowest price but not its closed price. Can anyone show me how to do it? Thanks in advance.