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/

    How do I calculate volume/time weighted avg price? Any pointers will help.

    General Code/Help
    2
    5
    1265
    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.
    • chaitalidixit
      chaitalidixit last edited by

      I read blogs on position.price and cost basis but those discussions werent conclusive.

      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by

        Not really clear what are you looking for. Do you want to create VWAP indicator? Or calculate trade entry/exit VWAP? Latter is done by bt by default I think.

        chaitalidixit 1 Reply Last reply Reply Quote 0
        • chaitalidixit
          chaitalidixit @ab_trader last edited by

          @ab_trader yes, I want to calculate entry/exit vwap. could you let me know if position.price is size-weighted average price VWAP? and how do I calculateTWAP?

          A 1 Reply Last reply Reply Quote 0
          • A
            ab_trader @chaitalidixit last edited by

            @chaitalidixit

            could you let me know if position.price is size-weighted average price VWAP?

            I think so, I believe I've seen this discussion somewhere on the forum. Test it to be totally sure that it is what you are looking for.

            and how do I calculate TWAP?

            As an idea - get prices from notify_order for each executed order within single trade and then do all necessary calculations. At least I would start from there.

            1 Reply Last reply Reply Quote 0
            • chaitalidixit
              chaitalidixit last edited by

              thank you, surely a start to code a strategy

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post
              Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
              $(document).ready(function () { app.coldLoad(); }); }