Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1638
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
It's the last one, not the penultimate one(
Look at what you wrote:
" If price goes down and another order is opened, the order with the maximum OrderOpenPrice becomes the penultimate order. "
This function searches for max or min open price.
If you just want penultimate, you better remember the ticket when it opens.
Look at what you wrote:
" If price goes down and another order is opened, the order with the maximum OrderOpenPrice is the penultimate order. "
This function searches for max or min open price.
If you just want penultimate, you better remember the ticket when it opens.
I apologise, sometimes I don't make my point very clearly.
I have already done it by tick and by time, but in fluctuations, when price may go up and then down, it may not be the penultimate. These variants have already been worked out. So the opening price is the best option. Or a bunch of functions that will double-check it all, and there I'm sure I'll get very confused. I don't have a lot of time to keep everything in my head.
I've written before on the penultimate one and it gave out. One problem, didn't distinguish between OP_SELL and OP_BUY. When the second one appears, it starts counting it(
I apologise, sometimes I don't make my point very clearly.
I have already done on the tick, and on time, but in a fluctuation, when the price may go up, then down, it may not be the penultimate one. These variants have already been worked out. So the opening price is the best option. Or a bunch of functions that will double-check it all, and there I'm sure I'll get very confused. I don't have a lot of time to keep everything in my head.
I've written before on the penultimate one and it gave out. One problem, didn't distinguish between OP_SELL and OP_BUY. When I get the second one, it starts counting it(
Write simply what you need to find (if it happened, you need to get it)...because I'm already confused too
Write simply what you need to find (if it happened, you need to get it)...because I'm already confused too
I have highlighted which order price you need to find
It's not difficult if there is no OP_BUY. If OP_BUY appears, my code does not work(
Write simply what you need to find (if it happened, you need to get it)...I'm already confused too
It's not the penultimate order by time, it's the penultimate order by price if the price has gone the other way. Alexei has correctly written, we should search by price. We should not change the values of the maximal or lowest ones.
Zy. I would have remembered the last order (it's a grid) and put the penultimate one in my variable. The algorithm should only be refined, if up one and immediately down one and again up one and immediately down one)))) If two orders are going in one direction, then we should remember the ticket of the penultimate and last order just in case. If a third order opens, the ticket of the penultimate order is equal to the last one and the ticket of the last order is equal to the third one.
Highlighted in colour which order price to find
It is not difficult if there is no OP_BUY. If OP_BUY appears, my code does not work(
Try it this way
Try this.
Thank you for your hard work.
There is one nuance) It finds at the top, marked in red. For OP_SELL it is at the bottom, marked blue. And let me tell you right away, I didn't check how it will count if OP_BUY appears.
Thank you for your hard work.
There is one nuance) It is found at the top, marked in red. For OP_SELL it needs to be at the bottom, marked blue. And I must say right away that I did not check how it will count if OP_BUY appears.
Above is the nearest!
I asked you to write what you must find and you give out some portions.
For example, I need: "If a Sell has opened, I should find the nearest Sell from above... etc.".
P.S. What did you mark in red? I don't see 0_oThe one at the top is the closest!
I asked you to write what you need to find, but you give out some portions...
For example I need: "If a Sell opened, then you need to find the nearest Sell from above... etc."
P.S. What did you mark in red? don't see 0_oIt happens to me. I think one thing and write another. Not attentive Sorry) At the expense of red itself in a shock)
It happens to me. I think one thing and write another. I'm not paying attention. Sorry. I'm shocked about the red one.)