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 to assign a market order execution price different than open

    General Discussion
    2
    5
    119
    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.
    • Matheus Pires
      Matheus Pires last edited by

      I know that might be weird for most traders, but my idea is to backtest a daily execution scheme where @ day "d" a signal is generated to buy/sell a quantity "x" for some asset, which will be sent as a VWAP or TWAP order to my broker @ the next pre-open day ("d+1") .

      Thus, since my actual broker (not backtrader's) has his own algorithm to execute the order throughout the day, it will be executed close enough to the realized TWAP/VWAP price. Finally, this is why I want to simulate a market order at some pre-set price (yeah I know I'm looking ahead for that, but this is intentional!).

      Thank you guys!

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

        Market order is executed by the price available in the market, it can not be specified. Use limit order if want the order to be executed at certain price or better.

        • If my answer helped, hit reputation up arrow at lower right corner of the post.
        • Python Debugging With Pdb
        • New to python and bt - check this out
        1 Reply Last reply Reply Quote 0
        • Matheus Pires
          Matheus Pires last edited by

          Thanks for your reply @ab_trader but I want the order to be executed at the TWAP/VWAP price, however if I set a limit order, it will be executed at the best price (i.e. the open price, if my limit price is the next day's TWAP price).

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

            so StopLimit order with the small difference between Stop and Limit prices will help.

            • If my answer helped, hit reputation up arrow at lower right corner of the post.
            • Python Debugging With Pdb
            • New to python and bt - check this out
            1 Reply Last reply Reply Quote 2
            • Matheus Pires
              Matheus Pires last edited by

              @ab_trader great call, dude! I didn't know about this StopLimit order

              Thank you very much!

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