Is there a way to access average trade duration (trading statistic) from a custom objective() function?

Short of that, can I use all_trades() inside the objective function
will that work as expected?