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 ?
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!
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 ?
What you're looking for is yesterday open and close price :)
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)];
double open, 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)
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.