Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Help with value (daily pnl), shortcash parameter and negative prices (spreads)

    General Code/Help
    2
    2
    242
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      momentum last edited by

      Hi,

      I am calculating the daily pnl (I understand this may be unrealised) based on the difference of value. In general this was working fine independent of whether setting shortcash to true or not. However, when started using spreads that can have negative value, it seems this works correctly only when setting shortcash to true. Is there some reason for this or should I calculate daily pnl in a different way?

      I am using version 1.9.70.122 in case that is relevant.

      Many thanks

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        You have diagnosed it down to the negative prices. Use positive prices (there is for sure some strange market where the spread can be negative ... but not here)

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors