Getting the correct portfolio value before closing position when using mult
When multiplier is used in backtrader, the multipliers multiplied return is only added once the position is closed. It leads to charts like this:
self.broker.getvalue() plotted better:
This rise didn't actually happen like at once like shown in the plot, but the multipliers profit is only added at positon close. In my exchange while trading pepetual swaps, the multipliers value is updated real time, not just on position close. This has lead to unrealism while doing the portfolio analysis. How can i achieve the same behavior in backtrader where the portfolio value is updated real time along with multiplier and not just on position close?
I have solved my problem. Mult acts like this, turns out what i want is leverage.