Monitoring PnL of specific positions.
-
I'm trying to monitor the last 5 positions PnL.

This only outputs the last position value... the SUM of the last 5 is my desired output. I'm breaking my head.
Anyone?Johnster.
-
Tried different variations for "for each position".
I'm expecting it to output loop values, not single values.
Looking for PnL (Profit) in that loop. -
every n trades empty, above set variable to 0, in formula block underneath take variable, save currently loaded trade profit back into the same variable from a loop value
-
Tried empty, let me try "0".
-
"0" gives same result. Only last (Newest) value, not the loop (5 newest sum) value... sigh
-
-
Add a shared link to see how it's all set up
-
See my 1st post above...
-
Not a picture a shared liunk, and the latest you have updated
-
Def. a bug.
Just build the thing multiple times... sigh. -
So add a shared link to see possible problems. I have used FX for years, and bugs are normality a miss placed block or function
-
@Johnster your variable "s1_buy_newest_profit" will be updated with a new value for each position on each iteration of the loop so it will only have the last value when the loop completes.
Declare a new double variable as "temp" and put it where "s1_buy_newest_profit" is in the modify variables block.
Add a new formula block after the modify variables block
Put "s1_buy_newest_profit" as the left operand
Put "temp" as the right operand
Add the 2 together and put the result back into your "s1buy_newest_profit" variable that will become be the result of the sum of the loops. -
I forgot to add that you will need to set the variable "s1_buy_newest_profit" to zero in a modify variables block before the for each position block.
-
