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/

    Buy/Sell prices off

    General Code/Help
    2
    3
    652
    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.
    • K
      kazi last edited by

      Hi backtrader,

      Thank you for this great project! I am seeing strange buy and sell prices:

      2017-12-25, Close, 0.00061700
      2017-12-25, BUY CREATE, 0.00061700
      2017-12-25, BUY EXECUTED, Price: 0.00059600, Cost: 0.00059600, Comm 0.00000060
      2017-12-25, Close, 0.00060900
      2017-12-25, Close, 0.00060700
      2017-12-25, Close, 0.00060200
      2017-12-25, Close, 0.00060200
      2017-12-25, Close, 0.00060500
      2017-12-25, Close, 0.00060200
      2017-12-25, Close, 0.00061700
      2017-12-25, Close, 0.00061100
      2017-12-25, Close, 0.00061500
      2017-12-25, Close, 0.00060200
      2017-12-25, SELL CREATE, 0.00060200
      2017-12-25, SELL EXECUTED, Price: 0.00059200, Cost: 0.00059600, Comm 0.00000059
      2017-12-25, OPERATION PROFIT, GROSS -0.00000400, NET -0.00000519
      2017-12-25, Close, 0.00060600
      

      The buy and sell parameters are set as follows:

      self.order = self.buy(price=self.dataclose[0])
      self.order = self.sell(price=self.dataclose[0])
      

      The commission has been set to 0.001.

      Please let me know if you need any further information.

      Thank you in advance!

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

        Since you are using market orders, than price parameter in the self.buy and self.sell is not used. Market order is executed based on the next available price - next bar open. If you want to specify the price of order execution, than you need use stop or limit orders. Please check the following doc section -
        Docs - Order Management and Execution

        K 1 Reply Last reply Reply Quote 1
        • K
          kazi @ab_trader last edited by

          Thanks @ab_trader I should have seen that! Appreciate your help.

          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(); }); }