How can i close a group of trades when they are in specific profit,EVEN there are multiple others running in loss?
-
How can i close a group of trades when they are in specific profit,EVEN there are multiple others running in loss?

-
Take a look on this thread:
https://fxdreema.com/forum/topic/7363/how-to-make-that-close-condition/9
-
I am sorry but i am not so good to understand how...
-
-
Hi!
How do you distinguish "this group" of trades from all other trades? By trade age?For example: pick all trades that are 2 days old -> if this group is net profit -> close this group
Sounds good? I can make the algo -
@roar
Hello!Sorry for the late reply,i was away for business and couldn t reach FXdreema.I am sending you another screenshote to tell you exactly what i need.
Is there any function that:
Check if we are in a specific or bigger Drawdown,then whe give the command that when 2 or three winning trades are overcome the loss of one or two losing to close them?

-
@fxmich78 I made this very simple, we can improve from here if needed.
https://fxdreema.com/shared/MzuDN140b
How the logic goes in this:- If biggest losing trade is down $200 or more
-> Check if overall account is on profit (equity > balance)
-> If yes, close ALL trades
- If biggest losing trade is down $200 or more
-
@roar
First of all,thank you for your Kindness to help me .I really appreciate this!Second,in the example we have lets say.7 open buys.
The currend DD lets say is -600$.
BUT in the mean time we have 2 out of six trades starting to profit.
What i want is:
when the profit of these two trades(We are still in big DD though) are big enough to overcome one loosing trade,i want these three to close.
I hope i made it clearer.Or not?I want this function to take place only when we are on a specific or more drawdown.
-
@fxmich78 This should be pretty close: https://fxdreema.com/shared/cMfIpPQtd
It uses lots of loops, and thus not very easy to understand
First loop just finds the biggest loser.
Second loop starts going through all trades, starting from biggest winner. It makes a sum of the profits, and when that sum is bigger than the biggest loser, it activates 2 last loops: firstly it closes the loser, secondly it closes x number of biggest winners (x being TradeCount variable)Constants and variables are your best friends in FxDreema https://fxdreema.com/tutorial/builder/constants-and-variables
-
@roar
Thank you again for your effeort.
I will try to understand all these code and i will contanct again whether for a problem or to thank you once again.! -
@roar
I am sorry my friend,but i am trying to compile it and it gives me errors.
-
@fxmich78 Sorry, forgot to mention - I used variables in this project, and if you copy the blocks, you have to declare the same variables.
Update your constant and variables (find them in left panel, below project name) as these:


-
@roar
lets try,they seem very difficult as i am self tought. -
@fxmich78 I'm self tought, too - didn't visit this forum for a year or so when I started

Help is always positive, but in the end, you learn the fastest by trial and error -
@roar
can i add in the ex you sent me my code to see how can we solve it,as i did that but maybe i am doing something wrong and do not work.? -
@fxmich78 You can share the project from the Projects-menu in upper left corner
-
@roar
https://fxdreema.com/shared/Iu8dsAEFbCan you add in this the situation that,when we are in DD lets say,200$ and we have many positions open,then,WHEN some positions start to profit,they will have to close along with a loosing position given the fact that they overcome the total profit BETWEEN them.
-
@fxmich78 https://fxdreema.com/shared/le2CyfDhb
I put my blocks to the project. Now it is closing the biggest losing trade, if winners cover it.
Note that this is not going to close the 2nd biggest loser, or 3rd biggest, it always focuses on the biggest.You can download the .mq4 and then import the file to your builder, the variables will come along that way.
-
@roar
I have two questions.
What if i want to close the lowest loser at the moment 1 or more winning trades cover it?and,second,how can i import it after downloading?(i am sorry if i cause you too much trouble)
-

So it would be better and easier in pips to close all orders in profit, for those who have been looking for this and see, I realized that this forum has many questions and few answers that solve the problem
