Record real-time gain and loss in variables.
-
I would like to know how to record real-time gains and losses in trading.
By recording these gains and losses in a variable I would like to impose a condition that is as follows:
Check if the total sum of the gain positions in progress has a value greater than the sum of the total loss positions in progress, that is, if the gain is greater than the loss, close all open positions.
-
@fabiobioware You can put your account equity and balance into a condition.
-
@roar I believe that I did not express myself well in what I wanted, I will put below an image, explanation and share the project:

The image shows some values that if added together give the value of -181.00
I would like TOTA VALUE LOSS to add only the values that are negative in the trades in progress, if we add -9, -68 and -112 the value that should appear in TOTAL VALUE LOSS would be - 189.00
In Total value Gain only 8.00
-
Use this structure on the 'on Tick' tab before updating your 'Total Value Loss' variable:

-
But this block checks the closed deals, I just want to check the ongoing deals.
-
@fabiobioware Look hard and you will find a pink block for live trades as well
-
Sorry. I took the wrong block!
Choose a 'For each trade' block.