Please edit your post and use the code button (Alt+S) when pasting code.
EDIT your original post, please do not just post the code correctly in a new post.
When you compiled did you not get the warning
"empty controlled statement found" ?
and you did nothing about it?
Don't ignore warnings, they help you.
if(Close[i+1]<Close[i+2]<Close[i+3]<Close[i+4]<Close[i+5]); x=x+1;
x is being incremented every pass of the loop.
You will also be getting an array out of range error
for(int i=0; i<Bars; i++)
when you are checking bar[i+5] and i==Bars-1, you are checking bar[Bars+4] which doesn't exist
if(Close[i+1]<Close[i+2]<Close[i+3]<Close[i+4]<Close[i+5])
William may come along and explain why this is wrong better than I can
Why don't you just use iLowest()?
int number_of_bars=5; int limit=Bars-number_of_bars-1; int x=0; for(int i=1; i<limit; i++) { if(iLowest(_Symbol,PERIOD_CURRENT,MODE_CLOSE,number_of_bars,i)==i) x++; Comment(x); }
Not tested.
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.
True = non-zero and false = zero so you get:
if( 3 < 2 < 1 ) if( false < 1 ) if( 0 < 1 ) if( true ) | if( 3 > 2 > 1 ) if( true > 1 ) if( 1 > 1 ) if( false ) |
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
But when I test it, it gives me unrealistic numbers.
I don't think I am coding it correctly . Need help
for(i=0;i<Bars; i++)
{
if(Close[i+1]<Close[i+2]<Close[i+3]<Close[i+4]<Close[i+5]);
x=x+1;
Comment(x);
}