How to implement the closing of positions one at a time after N minutes ? - page 6

 
Vitaly Muzichenko:

This is the third time I've asked:

Under what conditions could it ever work, even once every 100 years?

Vitaly, there is no need to fill your head with dogma.

MQL is a tough language and understands what you and the guy above (hopefully just yet) do not know.

Good luck!
 
Renat Akhtyamov:

Any questions?

Yes, there are.

Every line of code must be justified, so justify your code highlighted in yellow. And don't get stuck on it.

 
Vitaly Muzichenko:

Remaining.

Every line of code must be justified, so justify your code highlighted in yellow. And don't stall.

Vitaly code works

false is "-1" among other things

and that's all

 
Renat Akhtyamov:

Are there any questions left?


Yes. Do you really think so:

false is "-1" among other things

or are you just having fun?

 
Ihor Herasko:

Yes. Do you really think so:

or are you just having fun?

Well, run my code, if you don't believe me, try to open a wrong lot or something, enter a price that is far away from the current one, takeaways, stops. Anything.

And they will tell you in Russian what is wrong.

The matter is just to add one line to the code, which caused suspicion in you and Vitaly...

Then use it in good health!

 
Renat Akhtyamov:

If you don't believe me, try to open a wrong lot or something, enter a price that is far away from the current one, takeaways, stops. Anything.

And you will be told in Russian what's wrong.

All you need to do is add one line to the code, which made you and Vitaliy suspicious...

Well, use it in good health!


Let's move away from the code as a whole. We are talking about a small part of it, which you have nicely crystallized in post #53. There's only one point that interests me: are you serious when you say that false is "minus one"?

 
Ihor Herasko:

Let's move away from the code as a whole. After all, we are talking about a small part of it, which you have nicely crystallised in post #53. Only one point of interest: are you serious when you state that false is "minus one"?

maybe the function returns minus one including closing error, didn't get into it, but my code works.

and it works in conjunction with all opening, closing, deleting and modifying trades without any problems!

and i'm only arguing because it says otherwise.

 
Renat Akhtyamov:

maybe the function returns minus one including closing error, didn't get into it

It can't, because OrderClose():

Returned value.

Returns true if the function completed successfully or false if there was an error. You must call GetLastError() to get the error information.

In turn:

The booltype is designed to store the logical values true or false, whose numeric representation is 1 or 0 respectively. The internal representation is an integer of 1 byte in size. Note that in boolean expressions, it is acceptable to use other integer or real types or expressions of these types instead of bool, and the compiler will not generate an error. In this case, value zero will be interpreted as false, and all other values as true.

And it works for all opening, closing, deleting and modifying trades without any problems!

Once again: this is just a small part of the code. That's all there is to it.

P. S. Gone to bed.
 
Renat Akhtyamov:

maybe the function returns minus one including closing error, didn't get into it, but my code works.

and it works on all open, close, delete and modify trades with no problems!


Yes, the code works.

I use int instead of bool in your code for close

int close;

And ticket use one for all buy and sell closes, well it's just for checking. Maybe because of this error, because buy is closed and there is no close for sell.


 
Natalya Dzerzhinskaya:

Yes, the code works.

I use int instead of bool to close in your code

int close;

And one ticket is used for all closes buy and sell, but this is just for test. Maybe because of this there is an error because buy is closed and there is no close for sell.


Are there any messages in Russian in the Experts tab?

Did you add a function with errors with translation into Russian at the end of the code?