@vladisld I changed my code to adapt to the error so I can't post the exact trace now but I remember it happening in the multiprocessing module: float Division by zero error. But I figured out that trailpercent wasn't the issue. ADX was probably causing some error unexpectedly, it doesn't have any safediv param either. I don't know why it happened on a subset of the data but never on the whole data.
Besides, the StopTrail is causing problems too, I thought that if I set the trailpercent=1, then it would just be the normal execution without any stoptrail getting executed because it lags by 100% of the price so why is it making my returns so negative as compared to my returns without using stoptrails? Shouldn't they be the same?