How can I close two or three deals out of ten or more deals?
-
How can I close two or three deals out of ten or more deals?
So that if I have ten short deals and I want to close the two deals that total zero
Is there a suggestion ,advice -
@khalids222 You will need a loop searching for all open trades and then a subloop to identify those whose total is zero. Certainly a complex loop. I'm afreid I cannot help you to create it. Maybe miro or roar can help.
-
@l-andorrà Thank you.
@roar It seems that this problem will not be solved except with you.
Is there a response please or the matter is complicated? -
@khalids222 thats a very ambigious question.
So you have 10 trades, and the EA needs to check if ANY 2 trades sum to 0?
Trade 3 and 7 sum to zero, trade 10 and 1 sum to zero, trade 9 and 8 sum to zero ... ?
There are 10!/(2^5*5!) = 945 different cases to check.Happy building lol
-
@roar Let me clarify to make the picture clearer:
Suppose we have any number of deals, whether two, three, or more.
Every time or every trade I want to combine the sell with the buy if their sum is equal to one. I want to close the deals that are equal to only one.
Regardless of the sell and buy value, as long as the sum is greater than one and not zero.
Usually, most of the loss is when the market goes up or down, and if we assume the market went in an opposite direction to you, there will be increased trades and thus a loss of the balance.
The best way to avoid this is to close the sell while buying at the same time every time the total is positive
I am not good at English, but simply any buy + sell position is equal to a positive number. I want to close these specific deals -
@roar Simply any buy + sell equals = (+)positive .
I want to close the buy + sell exactly -
@roar
This is a simple example, but as you can see when opening, he closes only one trade and does not close the second, I need logic to define both deals together.
https://fxdreema.com/shared/d7bb2S8Ub -
@khalids222 said in How can I close two or three deals out of ten or more deals?:
@roar
This is a simple example, but as you can see when opening, he closes only one trade and does not close the second, I need logic to define both deals together.
https://fxdreema.com/shared/d7bb2S8UbWho has an answer or suggestion for this method
Simply any buy + sell equals = (+)positive .
I want to close the buy + sell exactly -
@khalids222 The problem is that what roar said is true. There are simply to many possible options. There should be additional conditions to filter all those potential combinations.
-
@l-andorrà Thank you again. I appreciate your time and effort, however his words - * roar * are incorrect, or he did not understand the idea well.
The subject has only one possibility
Buy + Sell = Positive Simply close the two transactions.
In general, my problem is not that I have solved this problem, but my problem is how to determine which deals to close. -
@khalids222 But what if you have 4 buys and 6 sells? Then 2 buys are positive and the other 2 negative. Same for the sells. What additional conditions are required to identify which one of them you want for them to be closed?
-
@l-andorrà Let me explain the example
https://fxdreema.com/shared/kdjMLA89c

In the beginning the sell condition will be the same as the buy condition .
The second point will be to determine theMAXIMUM buy and the MAXIMUM selling, the minimum buy and the minimum sell .
Then I will collect minimum buy+ maximum sell /2 =
We will see the blue line in the image
What I Want Now: I want in every buy or sell to collect value (miuimum buy + maximum sell) if = > +1 close minimum buy & close maximum sell
I don’t want to buy together, or sell together -
@khalids222 I understand, but you will have manu open trades at the same time. The problem is which one to select from eahc side (buy and sell) to make your condition true. Thare can be several combinations that can match your requested result. How can they be filtered?
-
@l-andorrà said in How can I close two or three deals out of ten or more deals?:
I understand, but you will have manu open trades at the same time. The problem is which one to select from eahc side (buy and sell) to make your condition true. Thare can be several combinations that can match your requested result. How can they be filtered?
Simply the method is as follows:
Every time minimum buy , or maximuam sell = + A certain number, whatever (3 or 5 .10 etc)
close minimuam buy + close maximuam sellin other words, when the minimum buy amount reached to win five points for example, close the winning position here ( minimum buy + close maximmuam sell) regardless of winning or losing .
The opposite is true when the maximum selling reached to win five points close maximuam sell + minimuam buy regardless of winning or losing .