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?