It's literally just a specialized take profit/stop loss system. It is to ensure your bot doesn't make any bad moves that you wouldn't have manually. The code should be pretty well annotated. Putting this into my scripts has made them much better. I will work on a Multiple Trigger template next.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.