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



  • 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!



  • 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



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


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.