double topValue;
A random value can always be above 25.
A random value can always be above 25.
what do you mean? i dont put random value on topIndex & bottomIndex
and what you are highlighting is topValue which is not related to the question
Be it "topValue" or "topIndex" or any of the others, you declared the variables but never assigned an initial value to them. Hence, they have random initial values.
When you compiled, did you not get the warning "possible use of uninitialized variable"?
Be it a warning or error, you should always fix them!
Be it "topValue" or "topIndex" or any of the others, you declared the variables but never assigned an initial value to them. Hence, they have random initial values.
When you compiled, did you not get the warning "possible use of uninitialized variable"?
Be it a warning or error, you should always fix them!
yeah, i got the warning
i see, so there are no null value in MQ5? it will assign random value?
I have compiled your code as a Script and tested it against EURUSD H1, and I do not get any of the strange behavior you claim.
Maybe you can provide a print out of what you are getting on your end as well as the test conditions you are using!

- 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, i'm new to mq5 (but i'm familiar with code, because i'm software engineer)
i encountered a problem as stated on the title, here's my code
as you can seee the value topIndex and bottomIndex should never be above 25
but when i run the code, it sometimes print 5,6,7,8 LOG
not sure why 1,2,3,4 not printed while 5, 6, 7, 8 got printed
the values varies, but it always above tens of millions