Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 423
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! Help me resolve the situation: I open a position 1 under the condition of Y1, closed under the condition of Y2. But if before the occurrence of U2 once again occurs U1 and opened position 2, it does not react to come U2, and hangs to the next U2, which came after the new U1 (!) And this new position is not closed by a new U2, and waits for the next condition U1-U2. How to avoid that? My head is killing me. Thank you.
We need a loop for closing OrderClose(...) of all orders on condition U2 - even if we have a hundred of them. We can delete one on every tick - then do the following: 1) by U2 condition, raise the flag. 2) If the flag is raised, delete ONE order. 3) If there are no orders, lower the flag. Then all orders one after another will be deleted....
We need a loop for closing OrderClose(...) of all orders by condition U2 - you can open a hundred of them at once
I'm on a cycle as it is. Is there something wrong with it?
I'm on a cycle as it is. Is there something wrong with it?
I don't understand - I used SRC to insert code and I can't see it.
You have to press Paste and then Add
Above, though not in the right place, but it reads. Oh! Now it's in the right place. Oh, my goodness!
I have inserted your code correctly.
First press the SRC button, then commit your code into the window, press the "Insert" button and submit your message.
Thank you for your reply!
You're welcome. Try using multiplatform features like this:
There are 2 errors in the code. 1) This page explains the order of orders in the loop. 2) break - exit from the loop and continue - skip this
I have inserted your code correctly.
First press the SRC button, then commit your code to the window, press the "Insert" button and submit your message.
Thank you. (chuckles) At least you made me laugh at my writing. What's the point of the question? Is everything correct in the loop?
Thank you. (chuckles) At least you made me laugh at my writing. What's the point? Is the cycle right?
You have already been answered:
Forum on trading, automated trading systems and testing of trading strategies
Any questions from beginners on MQL4, help and discussion on algorithms and codes
STARIJ, 2018.01.18 20:19
There are 2 errors in the code. 1) This page explains the order of orders in the loop. 2) break - exit from the loop, and you should continue - skip this
You have already been answered:
Yes, thank you, I read the page. Only my knowledge in MKL4 was enough only to notice that in my loop positions are looped from zero to the last, while in the example vice versa, from last to zero.I still don't know where to insertthe break. And when I changed my loop to reverse, positions stop closing at all.