Store Profit whenever there is position // if no more position, profit resets to 0
-
Hello guys,
How do i store Profit into a variable whenever there is position. Then if there are no more position, then the variable profit resets to 0.
For example I trade Buy and sell at the same time. Now the buy is closed at 10$.
So the variable profit will be = 10$
Now, if i close the sell position and then there are no morer positions, the variable profit resets to $0.
Thank you.
-
Not sure if I fully get it. If your buy is $10 in profit, your sell will be at least -$10 in loss, so the combined profit will be slightly negative, not positive 10. Do you mean counting buy and sell profits separately maybe?
-
@l-andorrà yes, counting buy and sell profits separately.
will only reset once there are no more positions.
-
Any idea please?
Its like i am hedging and earning profits from buy and sellCheck position > 1
Check closed trades
Buy profit = store in variableChexk position = 0
Buy and sell profit = 0 -
This is what i came up with:
But it did not store any closed position profit. -
you don't need the check count block, did you want the profit or the price level?

-
@jstap i want to profit to be stored WHENEVER there is still position. when all positions are closed either buy/sell. The stored profit resets back to 0
-
use purple (like you have ) on trade, then pink blocks to get the last trade profit. This should give you all you need.
-
@jstap but that will only store the last position profit right? What if i closed 5 buys and 3 sells all in profit? I want to separately store them
-
more difficult, but simply tee off the pink with saving the information for each running trade
-
@jstap said in Store Profit whenever there is position // if no more position, profit resets to 0:
more difficult, but simply tee off the pink with saving the information for each running trade
Apologies for this, but what do you mean by tee off the pink?
-
what I mean is the for each (pink) - under the trade closed block - connect more than 1 pink for each changing the relevant modify variable block, then the next pink off yellow, this will collect the profit from every trade.
-
@jstap I tried to recreate what you said but i cant still store the profits:
Hope you can check. thanks.
-
I mean like this, every time it com[lates the loop and saves the relevant data into the relevant variable, it will move onto the next, then the next etc

-
@jstap so it will only save up to 4 closed trades? would it be possible to make it unlimited?
-
Yes create as many as you need, just make each pink block missis already recorded trades and save the next. The bink block for trade 4 would look like this:
