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/

    Questions on tradeid

    General Discussion
    1
    2
    72
    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.
    • J T
      J T last edited by

      Hi
      I have read the tradeid mentioned in live trading but I do not fully understand.
      The aim is to trade live using IB. And I am trying to implement a dynamic change of stop loss.
      I sent the order in using a parent order with stop loss and limit. Then I want to change the stoploss and limit later as the trade goes on.

      I have not been able to successfully do this as cancelling the old stoploss and then adding a new one, does not tag it to the open trade. The stop loss is like a whole new order on its own.

      I have searched through the forum and find maybe I can do a tradeid = tradeid in:

      self.cancel(self.long_stoploss)
      self.long_stoploss = self.sell(tradeid=tradeid, exectype=bt.Order.StopTrail, size=self.position.size, trailpercent=0.0005, transmit=False, valid=None)
      
      self.long_stoplimit = self.sell(exectype=bt.Order.StopTrailLimit, size=self.position.size, trailpercent=0.0005, plimit=plimit, parent=self.long_stoploss, transmit=True, valid=None)
      

      But can this be taken to live trading in IB as something that was mentioned in the docs about tradeid?

      1 Reply Last reply Reply Quote 0
      • J T
        J T last edited by

        Re: Questions on tradeid

        this is the docs: What I want to do is to tag the new stop loss to the open position. If there are other ways of implementation, kindly share with me! Thanks!

        IBBroker - Trading Live
        Note

        Following a request a tradeid functionality was implemented in the broker simulation available in backtrader. This allows to keep track of trades being executed in paralled on the same asset correctly allocating commissions to the appropriate tradeid

        Such notion is not supported in this live broker because commissions are reported by the broker at times at which it would be impossible to separate them for the different tradeid values.

        tradeid can still be specified but it makes no longer sense.

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