Total gains or loss operations
-
How to account for gains and losses from operations.
I want to print on the screen, for example:
Total Gainsr: 10
Total Losses : 5I want the quantity, not the value.
-
Do you mean trades or pips?
-
@l-andorrà trades.
-
The you can create two variables, one for gains and another one for losses. Compare each closed trade if it is >0 or <0 to put the in one side or the other. Then create a loop to count them all headed by a 'For each closed trade' block.
-
@l-andorrà said in Total gains or loss operations:
The you can create two variables, one for gains and another one for losses. Compare each closed trade if it is >0 or <0 to put the in one side or the other. Then create a loop to count them all headed by a 'For each closed trade' block.
can you give me any example with project on fxdreema?
-
You can try this for the winners only and duplicate it for losers (not tested):
https://fxdreema.com/shared/NFCWPM3Hc
Please remember that you will need to limitate the maximum number of closed trades to seach by the 'For each closed trade' block.
-
@l-andorrà not working.
-
Then try this for loser trades only. And again, rememberf to use the limit of maximum trades accepted wherever relevant in the EA (no here):
-
@l-andorrà said in Total gains or loss operations:
Then try this for loser trades only. And again, rememberf to use the limit of maximum trades accepted wherever relevant in the EA (no here):
This did not work, because I use the trailling stop, so when the price is closed with profit by the trailling stop it means that the stop loss was touched to be closed, but it was a profitable trade and is counted as a loss.
Do we have any solution that looks at each gain or loss in the operation? -
@l-andorrà Hi, I believe I got my friend,
I just include a condition under "For each close trades" to check if the gain on the closed trade was> or <than 0, if greater it adds +1 to the profit count if less it adds +1 to the loss count.
Now I will test it in the real market to see if the rule is respected.
Thank you very much my friend for your help. -
You are welcome

-
@l-andorrà @roar @FXDREEMA
it works perfectly in the backtest, but in the real market it does not work, it is not recording and counting the amount of gains or losses. I tried to use it to test the "profit period of time" block and the result was the same, can you help? -
Is this the same EA of your second thread?
-
@l-andorrà yess
-
Ok. Could you please forus on just one same thread, please?
-
@l-andorrà said in Total gains or loss operations:
Ok. Could you please forus on just one same thread, please?
yes, i will use the same.