[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 519

 
alex12:
Yes - from the original depot.
And the next time? Also from the original?
 
alex12:
Yes - from the initial deposit. Close orders - it is specified in the settings.

OK. Initial deposit of 1,000. On reaching 2000 close all unprofitable positions. Now the deposit is doubled and everything is closed. What's next? All you need to pull out of you?

Are you trying to write yourself or are you looking for A. Matrosov?

Everything there is simple...

 
artmedia70:

OK. Initial deposit of 1,000. On reaching 2000 close all unprofitable positions. Now the deposit is doubled and everything is closed. What's next? All you need to pull out of you?

Are you trying to write yourself or are you looking for A. Matrosov?

It's simple...


As soon as he closes the losing positions of his gridiron, his depo becomes smaller than the original one. )
 
Roger:

As soon as he closes the losing positions of his gridiron, his depo will be smaller than the original one. )
I'm used to counting everything by equity... Well, if it's a balance sheet, then yes....
 

The depo size is determined by the "account information" functions.

Stop loss -- these are the "trading functions".

The rest is up to you.

;)

 
Roger:
And the next time? Also from the initial one?

Yes. Alternatively, e.g. the deposit is doubled and if the profit of the original deposit is added to the doubled deposit.

Or like this: initial deposit = 10,000.

Next step: 20,000 then 30,000, 40,000 etc.

Or specify in the settings = 50% or 100% of the initial deposit.

 
peshihod:

The depo size is determined by the "account information" functions.

Stop loss -- these are the "trading functions".

The rest is up to you.

;)

Thank you, but I don't need the stop loss function to make the EA close large losses, but to simulate manual closing.
 
alex12:
Thanks, but I don't need the stop loss function to close large losses, but to simulate manual closing.

Are you aware of what you are asking?

1. the state of equity at the time of the Expert Advisor start needs to be memorised.

2. when the specified equity profit has been exceeded, the Expert Advisor needs to find all positions whose losses exceed the amount specified in the settings.

3. all these positions have to be closed within the cycle. After sending a closing request to close each of them, check the position closing fact, and if all goes well, close the next position, if not, then...

3.1. process the closing error by the error number and try (if possible) to close the position where the closing error occurred

4. as soon as all necessary positions have been closed, remember the new equity status to keep track of its increase.

In other words, you have a desire to have all this done by people who have absolutely nothing else to do... Sorry. I've laid out the logic - sculpt it.

Then come here with your code and if you have difficulties, they will help you. Or get people interested in doing something for you.

 
alex12:

Yes. Alternatively, e.g. the deposit is doubled and if the profit of the original deposit is added to the doubled deposit.

Or like this: initial deposit = 10,000.

Next step: 20 000 then 30 000, 40 000 etc.

Or specify in the settings = 50% or 100% of the initial deposit.


In general, I added two variables - one for the deposit level to be reached and the second for the number of files to be deleted. It will only work once, then you need to correct the level to another value or restart the Expert Advisor.
Files:
grider.mq4  26 kb
 
artmedia70:

Are you aware of what you are asking?

1. the state of equity at the time of the Expert Advisor start needs to be memorised.

2. when the specified equity profit has been exceeded, the Expert Advisor needs to find all positions whose losses exceed the amount specified in the settings.

3. all these positions have to be closed within the cycle. After sending a closing request to close each of them, check the position closing fact, and if all goes well, close the next position, and if not, then...

3.1. process the closing error by the error number and try (if possible) to close the position where the closing error occurred

4. as soon as all necessary positions have been closed, remember the new equity status to keep track of its increase.

In other words, you have a desire to have all this done by people who have absolutely nothing else to do... Sorry. I've laid out the logic - go for it.

Then come here with your code and, if you have difficulties, they will help you. Or get people interested in something, so that everything is done for you.

Thank you.

At least for me to test the EA in the tester.

I don't know why I came here.

A programmer is not just a programmer. For a beginner, of course, it is difficult to write such code. But for an experienced programmer it is almost a piece of cake.