In the Data Manager > Instruments, can you please add additional field to the instruments to store "margin", it can be "Percentage based" or "Size based".
Above change should be easy to do as you already have same thing for commissions.
Additionally in the "Trades" can you please add additional field to store the $ margin used?
These can be used in the stats calculations for custom code.