For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

How is Getvalue() Calculated?


  • administrators

    @hiep-pham said in 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.

    @hiep-pham said in How is Getvalue() Calculated?:

    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 broker.getvalue()

    order.executed.value is related to the execution price. If the execution price happens to be the opening price fine, but your definition is plainly wrong.

    @hiep-pham said in How is Getvalue() Calculated?:

    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 close


 

});