Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1950

 
JRandomTrader #:

Thank you.

Not bad. I don't like arrays)))), and it never works the first time without debugging in arrays. ))) Especially shifts, copying, sorting not regular)))
 
Valeriy Yastremskiy #:

Thank you.

Not bad. I don't like arrays)))), and it never works the first time without debugging in arrays. ))) Especially shifts, copying, sorting not regular)))

Every tool is good for its own sake.

But, insidious off-by-one error check and recheck ))

 

That's what a fresh look at your old code means!

I see two identical flaws, vestiges of the previous version.

One obvious sub-optimality.

And one obsolete design.

 
Hello. If I'm in the wrong place, please advise where to write, thank you.

Looking for a free MT5 Expert Advisor that will close positions ALL when a profit or loss is reached, specified in the settings, and open new positions immediately in the direction specified in the settings. Can someone give me a link to the thread?
Or maybe you know an EA that just opens 1 position on the market if it sees that there are no open positions and does not close.
 

MT4 1353

What kind of error is shown in the log?

Code works correctly


 
Vitaly Muzichenko #:

MT4 1353

What kind of error is shown in the log?

The code works correctly.


Looks like some objects created via "new" are not destroyed on exit.

 
JRandomTrader #:

Looks like some objects created with "new" are not destroyed on exit.

Yes, I found the problem.

Moved the call to the top of the program and the error is gone

 

Do I understand correctly that after a successful OrderSend, the data structure of the market order properties is not filled in, and the same opening price for this order should be obtained by performing an OrderSelect?

Another question: in 5ka, is it better to open a position immediately with a SL and TP, or to open a position first and then modify it?

 
Valeriy Yastremskiy #:

Do I understand correctly that after a successful OrderSend, the data structure of market order properties is not filled in and that the same opening price for this order should be obtained by performing an OrderSelect?

Not that I know of, and I have not seen it described.

 
Valeriy Yastremskiy to open a position with SL and TP or to open it first and then modify it?

As far as I understand, it depends on the price at which we need a loss and profit, the price that is in the terminal at the time of the opening request, or the price at which the position will actually open.