Is there a way to get the current margin / exposure % for backtesting?

I would like to know if there is a way to get the bar-by-bar exposure % for the purpose of testing out some position sizing concepts. For example I would like to start tapering down position sizing when my margin % flies a little too close to the sun.

This is easy to code for autotrading but I can't seem to figure out a way to backtest it. Is this something that would have to go through the custom backtester?

Yes, this would require a CBT because only in the second phase of the backtest do you have any visibility into your actual trades, equity, available cash, etc.

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.