Save Profit on closed trades
-
I've been working on a project with this condition.
- If there is open position -> every closed position -> store the profits
- if no position -> profit reset to 0
this is what my condition looks like but seems it doesnt reset and it continues to add up all the time.
what seems to be the correct way?

-
It seems repeatedly adding up the profits. Have you try make it just run once , like pass once, once per trade, ...
-
You can remove the 'if position buy' block. It is redundant in this context. You will need a separate block tree headed with a 'no position' block to reset variable to 0, as you want. Resetting it on the white input dot of pink loops in fxDreema doesn't work as expected, sadly. It should, I mean, your logic is correct. But input dots on pink blocks are messy, to put it mildly.
-
@sktsec i wanted it to store whenever there is open position and resets only when the account has 0 positions.
-
@l-andorrà
i want to EA to start counting profits only when there is 1 position.so if the account position is clear (no positions either buy/sell), then the counter will reset back to 0.
-
In that case you need to use the 'if position' block and specify value 0 to the variable at the yellow output dot there, not in the 'for each position' pink block.
-
@l-andorrà ill try thank you.
-
You're welcome.