[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 440

 
Has anyone come across a ready-made script with a condition to close all orders if the total profit is n pips ?
 
xmurik:
Has anyone come across a ready-made script with the condition to close all orders if the total profit is n pips ?
It seems to have
https://www.mql5.com/ru/forum/107476
 
xmurik:
Has anyone come across a ready-made script with a condition to close all orders if the total profit is n pips ?
I have one) but it's not in pips but in monetary units....)
 
7Konstantin7:
I've got it) but it's not in points but in monetary units....)

A daily ban for posting another decompile
 

Good afternoon friends!

Can you please tell me how to program the opening of a pending order with an expiry time equal to, for example, +10 minutes from the current time at the time of opening the order.

I really need it for writing my first Expert Advisor.

If it is possible to give a concrete example, since I am a dummie...

Thank you in advance.

 

Such a question - EA works on a small timeframe, disconnected its terminal for a couple of weeks+, when loading it starts to download the history and EA "reacts" to it by opening orders. But the history is already in the past and that's messed up. The Expert Advisor has to wait until the history is completely downloaded.

- How can we fight it?

Thank you!

 

Another question for the moderators - when we write a forum post, we press Enter at the end of the line. This results in a new "blank" (space) character.

- Why is it needed?

 
chief2000:

Such a question - EA works on a small timeframe, disconnected its terminal for a couple of weeks+, when loading it starts to download the history and EA "reacts" to it by opening orders. But the history is already in the past and that's messed up. The Expert Advisor has to wait until the history is completely downloaded.

- How can we fight it?

Thank you!



I set an indication in the "init" function that the EA needs to be initialised.

I check this indication in the "start" function and perform all the actions required for the initialization. As soon as everything necessary to the normal operation of the EA is done, I reset the specified sign. After that, the Expert Advisor is in the working state and manages the position.

 
PapaYozh:


In the "init" function, I set an indication that the EA needs to be initialised.

I check this sign in the "start" function and perform all actions necessary for initialization. As soon as everything necessary to normal operation of the EA is done, I reset the specified sign. After that, the Expert Advisor is in the working mode and manages the position.

Here is an example - the terminal starts up, and starts to download the history right away. The Expert Advisor does not know that the history is being downloaded - it starts the "init" from what it saw. Then the history was completely downloaded and it turned out that init was launched on a time interval, which had already passed.

I found a pending order several hundred pips away from the current price because there wasn't enough history when the terminal was opened.

 
chief2000:

Here's an example - the terminal starts up and immediately starts downloading the history. The Expert Advisor does not know that the history is being downloaded - it sees what it sees and runs "init". Then the history was completely downloaded and it turned out that init was launched on a time interval, which had already passed.

I found a pending order several hundred pips away from the current price, because there wasn't enough history when the terminal was opened.



I got it. Reread my reply.

Identify the signs by which you can determine that everything is in place for the EA to work. And program the correct execution.

Reason: