Yes, you can do it this way. Better don't detect stock splits by comparing bars, but check the PriceJump variable. Then run a loop over all open trades of that asset, regardless if they are phantom or pool trades. Multiply also TradeUnits with the PJ factor.

If you want to handle stock splits in your script, I suggest to do it either completely or not at all. Handling them completely involves adjusting all trades and all affected variables. Not at all means that the script just issues a warning, cancels all trades of that assets, and suspends trading with it. You must then close the positions manually and wait as least for the length of the lookback period before new trades can be opened.