hi GUMRai,
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; }
int last_red_candle_index=1; while(true) { if(Open[last_red_candle_index]>Close[last_red_candle_index]) break; last_red_candle_index++; } 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 ...
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]));
Hi GUMRai
int last_Red_candle_index=1; while(true) { if(iOpen(Symbol(),0,last_Red_candle_index) > iClose(Symbol(),0,last_Red_candle_index)) break; last_Red_candle_index++; } double Close_Above_Red_Candle_High = iClose(Symbol(),0,1) > iHigh(Symbol(),0,last_Red_candle_index); if( last_Red_candle_index < 3 && Close_Above_Red_Candle_High && Volume[0]==1) 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

- 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,
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.