Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. Tornar Yang
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 3
    • Best 1
    • Groups 0

    Tornar Yang

    @Tornar Yang

    1
    Reputation
    1
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    Tornar Yang Unfollow Follow

    Best posts made by Tornar Yang

    • Commission Setting

      Hi,

      When I set a percentage commission in the engine, I get a lot of rejected trades.

          cerebro.broker.setcash(10000)
          cerebro.broker.setcommission(commission=0.018,margin=False)
          cerebro.addsizer(bt.sizers.PercentSizer,percents=100) 
      

      If I set comission to 0, or set it to a low figure, I don't have this problem. Any advice what could have caused this?

      Tornar

      posted in General Discussion
      Tornar Yang
      Tornar Yang

    Latest posts made by Tornar Yang

    • Add % commission to the fractional size class

      Hi,

      I have added the CommInfoFractional class to allow factional size but it overwrite my previous configuraiton of a % commission. How can I add a % commission to it?

      class CommInfoFractional(bt.CommissionInfo):
              def getsize(self, price, cash):
                  '''Returns fractional size for cash operation @price'''
                  return self.p.leverage * (cash / price)
      cerebro.broker.addcommissioninfo(CommInfoFractional)
      
      posted in General Code/Help
      Tornar Yang
      Tornar Yang
    • RE: Commission Setting

      @run-out thanks, I am using percentage sizer which should only use 100% of my cash. Or was it percentage of something else?

      posted in General Discussion
      Tornar Yang
      Tornar Yang
    • Commission Setting

      Hi,

      When I set a percentage commission in the engine, I get a lot of rejected trades.

          cerebro.broker.setcash(10000)
          cerebro.broker.setcommission(commission=0.018,margin=False)
          cerebro.addsizer(bt.sizers.PercentSizer,percents=100) 
      

      If I set comission to 0, or set it to a low figure, I don't have this problem. Any advice what could have caused this?

      Tornar

      posted in General Discussion
      Tornar Yang
      Tornar Yang