Please, go to the examples and check those blocks - the purple "bucket" blocks and pink "for each..." blocks. There are some examples and each example have description.
In short, "For each... " blocks are used when you want to iterate throuhg trades, one by one, and do something with each one of them.
"Bucket" blocks are to be used when you want to get value (min, max, averate or total) out of a group of trades.
"Check profit (unrealized)" does everything inside - loads trades, collects data and checks the result.
Also check how to work with Variables. You can define as many variables as you want and modify them as you want. This is low level stuff and I will always recommend to not use Variables (at least not too many of them), but I will not add such functionality to collect profits over time.
What is the idea. If you have variable named "MyVar", then on each tick calculate the total profit and if the total profit is > than the value of MyVar => set the value of MyVar to that profit. This is simple. What is not simple is when to reset the value of that variable, because you have trades that will be closed and trades that will be opened. It sounds boring, but it depends.