@balibou thank you for your reply, I think exectype == 'Close' refers to the "close price" rather than close operation.
I've made a simple solution:
commissions = 
class CommInfo_My(bt.CommInfoBase): global commissions def _getcommission(self, size, price, pseudoexec): if commissions: comm = commissions * size * price if not pseudoexec: commissions.pop(0) return comm
def next(self): if condition1: commissions.append(0.0045) self.buy() elif condition2: commissions.append(0.009) self.close()