Any one can help me with this situation as i'm new to mql4 programing.
I would line to find the last red candle as it is showing in the attached photo. I know only one way to do that. But the problem is (What if the Red candle it is not in fifth bar back??) for Ex: if it in 4 or 3 or even in 7?
This is the way I do.
if(Close > Open && Close > Open && Close > Open && Close > Open && Close < Open)
Thank you for your response, As I told i'm new to mql4 programing and I read some article and see some video about loop BUT i'm not able to do that .
I found this code which is show the numbers of bar down or up. But i can't figure how to find the last down candle?
Any help will be appreciated.
int n, upbar, downbar;
double candleclose, candleopen, isitupordown;
for(n=50; n!=0; n--)
candleclose = iClose(Symbol(), 0, n);
candleopen = iOpen(Symbol(), 0, n);
isitupordown = candleclose - candleopen;
if(isitupordown>0) upbar= upbar+1;
if(isitupordown<0) downbar= downbar+1;
Comment("Last Red Candle Index Is "+(string)last_red_candle_index);
Study and I hope that you will understand
Thank you very much GUMRai,
I really appreciate your help, I read a lot but i'm not able to ...
I'm trying to use the code you post with (iOpen and iClose) But the application stop respond .
if(iOpen(Symbol(),0,last_red_candle_index) > iClose(Symbol(),0,last_red_candle_index));
Please assist to correct it.
Thank you for response
you mean this is the right one
if(iOpen(Symbol(),0,[last_red_candle_index]) > iClose(Symbol(),0,[last_red_candle_index]));
if(iOpen(Symbol(),0,last_Red_candle_index) > iClose(Symbol(),0,last_Red_candle_index)) break;
double Close_Above_Red_Candle_High = iClose(Symbol(),0,1) > iHigh(Symbol(),0,last_Red_candle_index);
if( last_Red_candle_index < 3
Alert(" Close Above Red Candle High "+Symbol()," ",TimeToStr(CurTime(),TIME_DATE|TIME_MINUTES)," M",Period()," ");
I have one problem with the above code, it keeping alert me with every candle that close above red candle until new red candle format, I try many way but i couldn't find the solution as i'm new to MQL4.
finally i limit it with this code,
last_Red_candle_index < 3
but this not what i need
appreciate your help