Navigation

    Backtrader Community

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

    yoghurtshawn

    @yoghurtshawn

    1
    Reputation
    51
    Profile views
    21
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    yoghurtshawn Unfollow Follow

    Best posts made by yoghurtshawn

    • RE: How can I show datetime rather than just date in x value in plot

      @Pablo-Reyes-Almagro It works! thx!

      posted in General Code/Help
      Y
      yoghurtshawn

    Latest posts made by yoghurtshawn

    • RE: Forbid short selling

      It seems this LongOnly sizer could do the trick. Right?

      class LongOnly(bt.Sizer):
          params = (('stake', 1),)
      
          def _getsizing(self, comminfo, cash, data, isbuy):
            if isbuy:
                return self.p.stake
      
            # Sell situation
            position = self.broker.getposition(data)
            if not position.size:
                return 0  # do not sell if nothing is open
      
            return self.p.stake
      
      posted in General Code/Help
      Y
      yoghurtshawn
    • Forbid short selling

      Hi community,

      Since short selling may be forbidden in markets like CHINA AShares, I was wondering if there were any settings in Backtrader ensuring that.

      Many thanks!

      posted in General Code/Help
      Y
      yoghurtshawn
    • RE: Idiomatic way for adding multiple ibstore live data with different resampling and the same backfill start date

      I found a similar exception as well. Does anyone have some idea about this problem?

      posted in General Code/Help
      Y
      yoghurtshawn
    • Multicore Optimization and self define analyzers

      Re: Mutidata + Multicore Optimization AttributeError

      Hi admin,

      As you said in this topic:

      The problem is that you have to store the PnL value in the stop method of the Strategy. Because unless you do that you talk to the last instance of the PnL which cerebro keeps record of. (With maxcpus > 1 it would be the same)

      What if I had a self defined analyzers which requires store some values in stop method. How can I modify my codes so that multi core opt could work properly, instead of error: AttributeError: Can't get attribute 'Lines_LineSeries_LineIterator_DataAccessor_ObserverBase_Observer_DataTrades_bd546845b4ba4f7489a48e0b65e9bec2

      Many thanks!

      posted in General Code/Help
      Y
      yoghurtshawn
    • RE: Does not trade correctly when use Volume Filler

      Anybody knows the reason?

      posted in General Code/Help
      Y
      yoghurtshawn
    • Does not trade correctly when use Volume Filler

      Hi community,

      I found it did not work correctly when using the filler.
      For example, I buy with a sizer of 3 every time, and set the filler to be FixedSize 1.
      There should be three OrderExecutionBit Objects in order.executed, with index p1, p2.
      However, I found 6 exbits were actually executed.

      like,
      [exbit0, exbit1, exbit2]

      1. execute exbit0, (p1 = 0, p2 = 1, len = 1)
      2. execute exbit0, exbit1, (p1 = 0, p2 = 2, len = 2)
      3. execute exbit0, exbit1, exbit2 (p1 = 0, p2 = 3, len = 3)

      It seems like p1 is set to 0 all the time, which might be the problem.

      posted in General Code/Help
      Y
      yoghurtshawn
    • RE: Daily summary on 1min level backtest

      @scottz1 Found it! That's really helpful! Thx!

      posted in General Code/Help
      Y
      yoghurtshawn
    • RE: Daily summary on 1min level backtest

      @scottz1 Thanks! How should I export the trade results?

      posted in General Code/Help
      Y
      yoghurtshawn
    • RE: Daily summary on 1min level backtest

      Thanks! How should I export the trade results?

      posted in General Code/Help
      Y
      yoghurtshawn
    • Daily summary on 1min level backtest

      Hi community,

      When I was doing backtest based on 1min kline data, could I also get analysis on daily performance, like daily trades profits, win/loss counts, daily drawdown, etc, say return in a list (one value per day.)

      Many thanks!

      posted in General Code/Help
      Y
      yoghurtshawn