You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You're right my oversight.
That's ok! I do the same thing all the time!
My log file tells me that when running the system it never goes beyond / past the following line of code:
After going through the "for" loop (only once?? Should it not first complete the loop?) it goes back to the first declaration, which is:
It then just keeps on looping endlessly the same way. NEVER computing the next major "if" statement - EVEN IF IT IS TRUE!
if (nBarHighNo > nBarLowNo)
I think I have found something!
The NBarHighNo can be less than 4 (even as low as 1) so when the "for" loop starts going the counter (for (int i = nBarHighNo; i >= nBarHighNo - 4; i--)) can be reduced to a minus value, i.e i = -1,-2, or -3.
That means we will have the following situation e.g. High[-3], which does not make sense, because that is looking into the future!
What do you think? Is this the problem? And if so how do we solve it?
iHigh(NULL,0,5)==High[5] the high of 5 bars ago. If you want the highest high of the last 5 bars you need
Thanks again WHRoeder for pointing out my mistake with the HighestLevel variable. I personally would never have picked it up since I am still new to MQL4 programming and its many standard functions. I wish I had your knowledge and expertise, but I am sure that it also came through years of applying yourself and learning by experience. Not sure how I can ever repay you for your kind deeds, but I am sure the universe will see to it that you get your reward.
I have changed the code a bit to avoid the counter i from going into the negative, but I am not sure if the logic is correct.
Here is the code:
At last the Strategy Tester are running now, but I am experiencing the following strange problems:
1. The High[] array has no prices. Returns 0 for every instance.
2. The Close[] array similarly does not have any values. All read = 0
3. The Open[] has got values/prices.
Because Close[] has no value (=0), but Open[] do have values, the expression
will ALWAYS be true - therefore the loop!
So if i can solve the mystery why the arrays High[] and Close[] have no values I think the riddle will be solved and the algorithm should work!
the while and break could be commented out leaving just the bracketed code. i++ isn't used there and isn't initialized
If the highest high isn't bar 5 what are those variables and what happens next?
the while and break could be commented out leaving just the bracketed code. i++ isn't used there and isn't initialized
If the highest high isn't bar 5 what are those variables and what happens next?
William, I sent some information as requested by private message to you.
(By the way my second name is also William!)
Usually, this error occurs when data in the MT4 chart history doesn't match between different time-frames. So, if a M1 bar high is 133.58 and M15 bar that contains this M1 bar has high at 133.56, the unmatched data error will be displayed. Try deleting history of that currency and reloading it.