Is MaxDrawdown supposed to be (Peak Price - Trough Price)/Peak Price? I believe what is being calculated is (Peak Price - Trough Price)/Trough Price. So you can get results over 100%... which seems incorrect imho.
I wrote the following codes to calculate (Peak Price - Trough Price)/Peak Price. Hope this makes more sense...
class ModifiedMaxDrawdown(CustomFactor):
def compute(self, today, asset_ids, out, values):
out[:] = (np.nanmax(values, axis=0)-np.nanmin(values, axis=0))/np.nanmax(values, axis=0)