How is Getvalue() Calculated?
After spending a fair amount of time to make sense the relationship between order.executed.value vs (self.broker.getvalue()
There isn't a relationship even if you look for one. One is for the order and the other is for the position. You can link them mentally, but they are not meant to be related.
that order.executed.value is the value of the current order position using the opening price of the NEXT period
This is WRONG and this has nothing to do with
order.executed.valueis related to the execution price. If the execution price happens to be the opening price fine, but your definition is plainly wrong.
self.broker.getvalue() use the close price of the CURRENT period
When you are in
next, prices have already happened. The only price which can be used to calculate the last (and hence current) value is the last price, i.e.: the