Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 327
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
Hello! I have a question about arrays. I have tried with difficulty to create a one-dimensional array. I should be fine, because I don't have any error at the compile time, but now I should run it in the tester and see error EURUSD,M1: array out of range in ,, (218,12) that indicates exactly the position of my grief array. Please tell me what's wrong with it
Hello! I have a question about arrays. I've created a one-dimensional array with some trouble. I should be fine, because I don't have any error at the compile time, but now I should run it in the tester and see error EURUSD,M1: array out of range in ,, (218,12) that indicates exactly the position of my grief array. Please tell me what's wrong with it
Your code is wrong at the root, but the error is due to the fact that the array size is not set before filling
Your code is fundamentally wrong, but the error is due to the array size not being set before filling
Thank you very much! Can you tell me please, is the sequence not correct? The idea is to determine the prices of the orders closest to the price from below and above. Please tell me your point of view.
Thank you very much! Can you please tell me if the sequence is not correct? The idea is to determine the prices of the orders closest to the price from below and from above. Please, tell me your point of view.
You have a lot of unnecessary things in your loop. You have to fill the array with prices in the loop and work with them outside the loop
You have a lot of unnecessary things in the loop. You need to fill the array with prices in the loop, and work with it outside the loop.
I see. Thank you very much!!! Did I get the idea right?
I see. Thank you very much!!! Did you get the idea right?
It's possible. The same task can be accomplished in several ways.
Vitaly Muzichenko:
It is possible. One and the same task can be implemented in several ways.
I just made a loop to determine the closest element indices and the tester shows an error at Mas[Blizko2].Maybe it's because there are no orders yet when I run the EA?
(Please advise, maybe you know where to look for something similar?)I have just put out of loop the definition of the closest element indices and in the tester shows an error in place Mas[Blizko2] .Maybe it is because when you run the EA there are no orders yet?
Try it like this
Try this
Thank you so much!!! I have another question: Am I correctly determining the index of the closest smaller element to the current price by changingMODE_DESCEND toMODE_ASCEND?
Thank you very much!!! I have another question: Am I correctly determining the index of the closest lesser element to the current price by changingMODE_DESCEND toMODE_ASCEND?
No answer, I've never usedArrayBsearch