I recommend you to begin with this block:

0_1585248504898_01.png

This block searchs for all open trades right now and all future trades and calculates an average SL proce for all of them. If you read carefully its info window you will understand how it works and how to customize it.