I have fixed volume for all trades and want to close equal trades from buy and sell
-
I have fixed volume for all trades and want to close equal trades from buy and sell
Example :
BUY = -70
SELL =+20
BUY= -20
SELL =+10
BUY= +15
SELL=-5
Here is the final total =
BUY= -75
SELL= +25
Here I want to close the same amount of buying and selling, which is +25 .
So that the buy = -50
Sell = 0
How can I do that, please? -
@roar I apologize, but we do not dispense with your advice and opinion. You are such a creative person, and this makes us follow you intently in all of your responses.
So please guide me
I've tried to create a method when there are multiple buy and sell
I collect buy and sell positions after half an hour, for example:
buy= -75 and sell = +25
Here I want to close the same amount of buying and selling, which is +25 .
So that the buy = -50
Sell = 0
How can I do that, please?
can see my project please
https://fxdreema.com/shared/lbEHYheYc -
@khalids222 oh, I'm flattered lol
Here's what I came up with, let me know if it works for you:
https://fxdreema.com/shared/qX2t8ZYYd -
@roar said in I have fixed volume for all trades and want to close equal trades from buy and sell:
Here's what I came up with, let me know if it works for you:
@roar Thank you very much you deserve more, it works right after every sell or buy and that won't let the price move.
I want to start half an hour after buying and selling or after one hour . -
@khalids222 we can add an age filter before the netting system:
https://fxdreema.com/shared/gKzcKNdwb

-
@roar Here, as you can see, the expert advisor works to close equal open trades from the beginning, and this will make him bankrupt the account within only a time.
Because it does not wait until there are many deals .
I want it when closing deals does not affect the balance as it is equal, for example, profit 100 loss 100 close it.
or profit 100 loss 300 close 100.
Usually when these operations exist, the level of loss will be greater than profit, and if you open a position on each bar, there will be a large number of deals.
So, for example, I want to set a time, such as after an hour or four hours, that the calculation process begins to close equal deals only, so that the balance does not affect anything by closing them. -
@khalids222 ok, so I made the netting for lot amount but you need netting for profit amount. Let me think of something.. .
-
You also see at closing, buying and selling is not equal in amount, only by volume.
And as you can see above, the balance decreases with every closing -
@khalids222 ok, this is actually pretty hard a problem. To pair wins and losses together, you must only partially close the bigger trade. Mql4 doesnt really support partial closing, it just closes the whole trade and then creates another trade with smaller volume. Because of this, you will always see your balance change.
https://fxdreema.com/shared/nSulvMHEd -
@roar Thank you, I appreciate your efforts and creativity. I will try it now
But I have a question, how can I know the value of the lot in some way? As an amount or points, not a number? -
@khalids222 alternatively we could just wait for the trades to line up, so that win = loss +/- 2%:
https://fxdreema.com/shared/DWK422a2d -
@khalids222 said in I have fixed volume for all trades and want to close equal trades from buy and sell:
@roar Thank you, I appreciate your efforts and creativity. I will try it now
But I have a question, how can I know the value of the lot in some way? As an amount or points, not a number?One lot is $100 000, you can just calculate it
-
@roar I mean if I have one lot, it contains a loss of 50 dollars or 50 pips.
How can I find out the value of it loss or gain ? -
@khalids222 use a loop block to select the trade and then you can use condition or modify variables to get the profit of that individual trade:

-
@roar Thank you very much and thank you for your wonderful efforts.
-
@roar
I tried to take advantage of your method, would you please look at the project?
I do not know why the balance is reduced at every close.
I tried to get away from the last two deals by value R4,R4 TO BUY AND R8,R9 TO SELL .
but at each close the balance is deducted
Possible total profit or LOTS. Not correct. I don’t know. Possible your opinion PLEASE?
https://fxdreema.com/shared/VBYFnuore
