Rebalancing by Closing Oldest Loss with In Profit
-
I've been trying to figure out this for a while but need some help, please?
Logic: the least profitable closes at a loss only when the in profit trades cover the loss + Xprofit
Example :
-
Trade 1 loss -20
-
Trade 2 Loss -5
-
Trade 3 profit + 20
-
Trade 4 profit +15
Close T4, 3 and 1 close.
- Trade 4
-
-
https://fxdreema.com/shared/TG8X1J4Lc
I've thought of collecting the values of all the + trades and oldest - trade as a variables and then using the close all profitable and the least profitable if value of all is at £X
Boxes 31 to 41 but it doesn't work? -
Not sure I fully get the logic behind it. Is the bot supposed to close ALL open trades regardless howmany of them are open roght now as far as there is a minimal overall profit maybe? Because what will then happen is that as soon as there is just one open trade in profit it will be immediatelly closed.
-
@l-andorrà The idea is that it only closes all the open trades that are in profit and then the oldest open trade that is in loss. The combined in profit and loss trades = x in pips or money before closing.
The other losing trades are left running and the cycle starts again.
I trade this manually at the moment and it's profitable if you are patient.

Hope this makes sense? Happy to answer any questions.
Cheers!

-
@l'andorrà you can also close the trade if there is only one open and that hits the take profit set by x pips/money. That is the ideal situation but if that trade goes into negative that's when the money management of rebalancing works.
-
1.I need to get a value from all running trades in profit and get a value of the least profitable(negative) trade.
2.Then with this value use it as a variable in the check profit (unrealised) as profit amount.
3.Then close all profitable and least profitableAny ideas how to get 1. so I can use it as a variable?
-
In that case you will need a custom array, because there can be different combinations of open trades in profit/loss. You will need a loop searching for all trades with those values and store the magic number into an array. Later, depending on the magic number and the profit/loss, closing them. Sadly fxDreema does not offer standard blocks to create custom arrays. You will need to hire a programmer to do it for you or maybe jstap can be helpful here. I'm afraid this goes beyond by capabilities, sorry.

-
@l-andorrà Thanks for this feedback, I thought that maybe the case looking at all of the options to do this. It seems a simple request to compare all in profit to 1st non-profit but now not the case.
Cheers
