Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1852
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
Check
Good morning Rostislav!!!
Could you comment on yesterday's changes I can't understand their logic
Good morning Rostislav!!!
Could you comment on yesterday's changes I can't understand their logic
If there are no open orders flag_close gets "0"
When flag_close=0; the request to ClosseAll() stops
If there are no open orders, flag_close will receive "0".
When flag_close=0; the request for ClosseAll() stops
Yes, I got it.
You need it when deleting objects.
The interesting thing is that if the flag is locked in this place, the Expert Advisor gets weird
Yes, I understand that.
Why it is needed when deleting objects.
The interesting thing is that if you block the flag in this place, the Expert Advisor starts to do weird stuff.
This has nothing to do with deleting objects
It is a determination of the absence of orders
You can perform any internal operations that do not require the absence of orders
Besides, there is a lot of unnecessary things in this part of the code,
This variant will do the same thing as the previous one
What does removing objects have to do with
it's about determining if there are no orders
and inside you can perform any operation that requires no orders
Besides, there is a lot of unnecessary stuff in this part of the code,
This variant will do the same thing as the previous one
I understand it, Rostislav.
I do not understand why, if I block the flag in this function, the EA starts to open and close 100-200 orders at a time
It's locking, from the word lock.
Yes. But a lock opens with the same lot. And two differently directed orders are opened simultaneously. A hedging is when a deal went into a drawdown, and the trader opens a position with a bigger lot in the same direction (I mixed up with different directions) implying that the price will reverse to make a profit on a deal with a bigger lot and cover the loss on a deal with a smaller lot or average to 0. If I got something wrong, correct me.
I get it, Rostislav
I do not understand why if I block the flag in this function, the Expert Advisor starts to open and close 100-200 orders at a time
I do not understand why, if I block the flag in this function, the EA will open and close 100-200 orders at a time
Let me explain using your code:
Initially, the flag is set.
Then it opens orders
If a close order condition comes up (you have three of them)
This flag gets value "1" and starts to close the orders
And once all the orders are closed, the flag gets "0".
Because if the flag is not "0", it constantly calls the ClosseAll() function
This may be the case provided the command to open an order is given. So there is a kind of "CHECKING" going on.
This may be the case provided the command to open an order is given. So there's a kind of "CALCULATION" going on.
You got a credit card?
You go into a shop and buy a beer one bottle at a time and each time you pay with the card until you get "0" on the card,
then go and refill the card and go and get another beer.