Hedging losses
-
In my ea the buy and sell orders are exclusive sets and close visa Versa. Note all trades close at once + buy and sells cannot be open simultaneously.
There are also two groups... group 1 is the initial order
And group 2 is accumulating/distributing.If I have the sum of the losses of my closed trades (group 1, 2, and manually opened trades) how do I use that value as The lot size of the next trade in group 1
Or would it be better to use the sum of volume of trades closed at a loss because the sum of losses would be in money
Most times when the trade close at a loss it's usually the spread
-
@purelife173 Can you please share the link to your project?
-
-
@purelife173 The problem can be the amount of closed trades to review. Is there any limit or will all closed trades from the day the account was open to be considered?
-
Yes all closed trades in a loss after the last candle has to be considered once (on tick).
group1 has to be in profit eventually so net profit of all trades are considered
Maybe trades from the start of the ea
-
@purelife173 Searching for all closed trades in the EA so far can be a mistake. Imagine you have thousands of them. That 'for each closed trade' loop will require a lot of time to search for them...every tick! Are you sure you need them all?
-
https://fxdreema.com/shared/qL2fT0E8b
okay then id like the sum the lot size of all open trades currently at a loss and less than cost (commission and swap) -
@purelife173 That is easier to get:

-
@l-andorrà In the last shared project I tried to sum the lot size of all open trades currently at a loss greater than or equal to 0.
I changed my idea since the first post to avoid processing many closed trades and instead work with the sum from the open trade. I then process that value to open a new trade when a specific instance occur
How ever I can't get the comment to output the correct value. Thanks so much I'll keep searching through the forums
https://fxdreema.com/shared/c8svvA1jc
it doesnt recalculate when some trades are in profit
-
Then you can try separating both variables like this example for another project I worked on:
https://fxdreema.com/shared/bKbTjhrse
In my example I'm counting pips from all open and closed traded and then I get the overall result. You can try the same for those trades in profit and in loss.